Apache prefork and worker issues
高洛峰
高洛峰 2017-05-16 17:03:39
0
1
424

Apache prefork handles requests with multiple processes. The worker mode is a process that uses multiple threads to handle requests. It is equivalent to multiple processes plus multiple threads. It can process more concurrent requests and consume less memory and CPU, but there are threads. Security issues. There are a lot of comparisons on the Internet about the differences between these two modes, all of which talk about the multi-process and multi-threading I mentioned.
Question 1: Since worker mode can improve high concurrency and save memory and CPU, why does Apache still use prefork mode by default?
Question 2: If Apache uses worker mode, and then uses Linux's epoll mode, can it support more than 10,000 concurrencies?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
仅有的幸福

Apache can of course use worker mode to process PHP. As you said, the ability to handle concurrent requests will increase and memory and CPU consumption will be less. However, the only drawback is that prefork is multi-process and multi-threaded, and some PHP extensions have thread safety issues, so if there is no thread-safe PHP extension, you can use it, but if it exists, it is best not to use it, otherwise it will cause data inconsistency. In addition, if apache uses epoll, it will It’s possible, but it’s probably a bit difficult to run over 10,000 concurrent users

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!