The completion process of an HTTP transaction: (Web server side)

Source: Internet
Author: User

The completion process of an HTTP transaction: (Web server side)

1. Establishing a TCP connection

2, accept the request (the Linux kernel accepts the request from the network card, after verifying the port number and hostname, sent to the corresponding web process)

3. Processing requests (Web service process)

4. Get the resource (the Web process reads the data from the hard disk into the memory space of the Linux kernel through the kernel, and then copied to the memory space of the web process)

5. Build response (Web software build response message)

6. Echo Response (message + Resource)

7. Record Log

When the user requests a Web page content, its data needs to enter from the network card, after TCP unpacking, found to be sent to listen to the 80 port of the web process, and then give it.


Multi-process:

The memory address space for each process is independent so that the amount of I/O is larger when copying data from the kernel space

Due to the process switch, need to keep the process of the site, and then switch back to the scene when you need to reply.

So you can't start too many processes

Multithreading:

The thread shares the resources of the memory address space of the process, so the I/O volume is smaller.

If the corresponding worker process crashes, all the threads under it will crash.


Nginx's working mode is to have a master master process, and n worker worker threads.

The master master process replicates only the read configuration, builds on demand, and recycles worker worker threads. The worker thread is only responsible for responding to user requests.

When Nginx upgrades only need to replace binary execution files, when a new connection comes in, the new worker thread will be used. The old connection still uses the old worker thread until it is disconnected until it is reclaimed.

This article is from the "Boys Kicked" blog, please be sure to keep this source http://rainbow168.blog.51cto.com/1060170/1551233

The completion process of an HTTP transaction: (Web server side)

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.