nginx and swoole how mixed use

There need to learn to communicate friends please join our exchange group together, there is a problem with the exchange, progress together! Provided that you are learning technology. Thanks for reading!

Click here to join the group jq.qq.com

 

Based on the Nginx epoll

With epoll, a process can theoretically unlimited number of connections, without the need for polling, the real solution to the problem of c10k. (Recommended Learning:  swoole video tutorial )

Nginx is based on epoll, asynchronous, non-blocking server program. Natural, Nginx can easily handle one million concurrent connections, there is nothing wrong.

How to deal with high concurrency swoole

①Reactor model introduced

IO multiplexing using asynchronous non-blocking program model classic Reactor, Reactor name suggests is the meaning of the reactor, which itself does not process any data transceiver. Just can monitor a socket (can also be a conduit, eventfd, signal) handles events change.

Note: What is a handle? Handle English as handler, can be likened to the image of the panhandle, spoon handle. That is a unique identifier for the resource, ID resources. This ID can be operated by resources.

Reactor just one event generator, the actual operation of the socket handle, such as connect / accept, send / recv, close the callback is completed.

Because the epoll based reactor, each reactor can handle numerous connection requests. So, swoole to easily handle the high concurrency.

nginx configuration:

 

 9501 is the address swoole server listens. root directory is set to static files. When the request is processed directly by a static file the Nginx, when the requested file does not exist, Swoole sent to the server for processing.

Guess you like

Origin www.cnblogs.com/heyue0117/p/12039943.html