案例
下面是我遇到的,非常好的concurrent server,它们都非常典型,并且有的提供了多种concurrency方式。
并发模型
在下面文章中,对此进行了讨论:
一、kegel The C10K problem
二、lwn The SO_REUSEPORT socket option
三、zhihu 如何深刻理解reactor和proactor? # 小林coding的回答
非常好的文章,将可能的并发模型总结得非常好。
大多数都是使用:
1、reactor、handler、acceptor
2、master worker
multiple thread
multiple process
Nginx
nginx has one master process and several worker processes. The main purpose of the master process is to read and evaluate configuration, and maintain worker processes. Worker processes do actual processing of requests. nginx employs event-based model and OS-dependent mechanisms to efficiently distribute requests among worker processes. The number of worker processes is defined in the configuration file and may be fixed for a given configuration or automatically adjusted to the number of available CPU cores (see worker_processes).
并发模型
多 Reactor 多进程方案
Redis
并发模型
读取解析命令-多线程
执行命令-单线程
返回响应-多线程
Memcached
并发模型
多 Reactor 多线程方案
inetd
TODO
Python
Gunicorn
Gunicorn is based on the pre-fork worker model. This means that there is a central master process that manages a set of worker processes. The master never knows anything about individual clients. All requests and responses are handled completely by worker processes.