Web Basic Concepts

Source: Internet
Author: User

What is HTTP?

HTTP is a Hypertext Transfer Protocol (Hyper Text Tranfer protocol) that works in the application layer. Hypertext is the text with hyperlinks (HTML Hyper Text Mark Language Hypertext Markup Language), The first Hypertext Transfer Protocol is just for the convenience of file retrieval tools, and there are not a variety of other things.

Here we mainly introduce the HTTP protocol implementation of the tool HTTPD (Apache)

Basic concepts:

URL (Uniform Resource Locator): Resource identification that describes the location of a particular resource on the server;

Process for a complete HTTP request:

(1) Establishing or processing connections: receiving requests or refusing requests;

(2) receive the request: receive the client to send the specific request message;

(3) Processing request: To parse the request message;

(4) Access to resources: To obtain the resources requested by the user through the storage io;

(5) Build the response message:

(6) Send the response message:

(7) recorded in the log:

Concurrency Response Model:

Single-process I/O model: serial response;

Multi-process I/O model: Initiates multiple processes at the same time, each responding to a request;

multiplexed I/O Model: A process responds to multiple requests;

Multithreaded model: One process generates multiple threads, and each thread responds to a request;

Event-driven: a process responds to multiple requests directly;

Multiplexed multi-process I/O structure: starts m processes, each process generates n threads, and each thread responds to a request;

Path mapping: It is to use the specified path of a file as the root of a program or system.

Type of resource mapping for the Web:

(a):D ocumentroot

(b): Alias

(c): Docroot of the virtual host

(d): User's Docroot

...

How to connect in HTTP request processing: A Web page has multiple resources composed of slices, text, and hyperlinks. Each resource is requested separately. In order to speed up the local client to start multiple threads, the server concurrently responds to multiple simultaneous requests from a client, but on the server side it is recognized as multiple separate requests, but only from the same IP address. When the client open thread is responding by the server, after the load is completed, because the TCP protocol is three handshake four disconnects, if the disconnection then requests the next resource is the need to shake hands again, resulting in a lot of wasted resources. Therefore, you must specify whether to keep the link request multiple resources at once. If a client requests only one resource, it consumes the server's number of threads. As a result, the following conditions occur:

Stay connected: Long connection, keepalive

Non-maintained connection: Short connection,

To limit the relationship between the two must be limited from [TIME] [quantity]


Implementation of the HTTP protocol

Common basic HTTP protocol servers:

HTTPD (Apache)

Nginx

Lighttpd

Application Server: Dynamic server technology;

Lis,tomcat,jetty. Resin, ...

Weblogic,websphere,jobss,glassfish ...

httpd

Www.netcraft.com (web site of software used on the Internet on a statistical web site)

Features of httpd:

Highly modular Design: core (CORE) +modules (module)

Dso:dynamic shared Objects (Dynamic shared object, supports dynamic loading and unloading)

The benefits of the module are the possibility of saving memory and reducing bugs

MPM: Multi-path processing module Multlpath processing modules (concurrency response model) 2.2 version not previously supported dynamic makeup offload 2.4 supports dynamic loading and unloading

Common function Modules:

Prefork: A master process and multiple child processes; The main process is responsible for controlling the child processes, creating sockets, accepting requests sent to the child process;

Child process: Responsible for responding to user requests

Worker: Multi-process multithreaded model; A thread responds to a request

Main process: Ibid.

Child process: Responsible for managing threads

Threads: processing and responding to requests

Event-driven model, multi-process model, each process responds to multiple requests;

Main process: Ibid.

Child processes: processing and responding to requests

Attention:

Http-2.2:event for test model (CentOS6 default installation MPM does not support dynamic DSO mechanism);

http-2.4 for formal (CentOS7 default)

HTTPD version:

httpd-1.3: Official has ceased maintenance:

httpd-2.0

httpd-2.2

httpd-2.4



HTTPD Features:

Cgi:common Gateway Interface; (Universal network Interface)

Virtual Host: IP, Port, HOSTNAME (based on IP. Port. Host name)

Reverse Proxy

Load balancing: bytraffic, bybusiness, byrequest

Path aliases

A rich user authentication mechanism

Basic

Digest

Support for third-party modules

...









This article is from the "11323677" blog, please be sure to keep this source http://zx337954373.blog.51cto.com/11323677/1825724

Web Basic Concepts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.