用于社交网站的 Apache mpm
我正在尝试建立一个社交网站,该网站将有大量用户同时登录,一次上限约为5000人。
我打算使用 LAMP 堆栈。 Apache 可以有 2 个 mpms(多处理模块)- preforker(每个请求分叉一个新进程)和工作模型(每个请求使用线程)。
考虑到我的服务器端代码是用PHP编写的,并且我希望能够按需扩展网站,哪一种更可取。我们使用的一些第三方 PHP 模块不是线程安全的,因此最好建议使用 preforker。
- 有什么方法可以在预分叉中减少交换进程之间的延迟
- 有什么方法可以使用工作模块,以及 php 吗?
运行在LAMP堆栈上的社交网站通常使用哪种模式?
I am trying to build a social networking website that would have a large amount of users logged in at the same time, with an upper limit of around 5000 at a time.
I plan to use the LAMP stack. Apache can have 2 mpms (multi processing modules) - preforker(forks a new process per request) and the worker model (which uses threads per request).
Considering that my server side code is in PHP, and I want to be able to scale up the website on demand, which one would be more preferable. Some third party PHP modules we are using are not thread safe, so ideally preforker is recommended.
- Is there any way by which delay between swapping processes can be decreased in preforking
- Is there any way by which I can use the worker module, with php as well ?
Social networking sites running on the LAMP stack, normally use which mode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果你打算做服务器推送服务,apache不是一个好的选择。看看 cherokee 和 nginx,两者与 php-fpm 的配合比 mod_php 与 apache2 的配合要好得多,因为您这样做不需要 CGI 支持(仅支持 FastCGI) cherokee 和 nginx)仅限 PHP。
几周前 我将 WordPress 网络从带有 mod_php 的 apache2-mpm-itk 迁移到 nginx+php5-fpm。结果,系统负载急剧下降,内存负载变得可预测,并且用户体验似乎快了很多。我还添加了一些来自 loadimpact.com 的免费测试,新配置的服务时间也更好。
If you plan to server push services, apache is not a good choice. Take a look at cherokee and nginx, both work much better with php-fpm than mod_php with apache2, since you do not need CGI support (only FastCGI is supported with cherokee and nginx) only PHP.
A few weeks ago I migrated my WordPress network from apache2-mpm-itk with mod_php to nginx+php5-fpm. As a result system load drastically dropped, memory load became predictable and the user experience seems to be a lot faster. I also added some free test from loadimpact.com, the serving times were better with the new config also.
对于如此多的请求,Apache 并不是首选。例如,你最好使用 nginx。 http://nginx.net/
“每台服务器 10000+ 个并发连接”听起来足够好了;-)
Apache isn't preferred with so much requests. You'd be better off with nginx for example. http://nginx.net/
"10000+ concurrent connections per server" sounds good enough ;-)
如果您不将 PHP 与 mod_php 结合使用,则可以在工作模式下使用 Apache。在 Fastcgi mod 中使用 PHP,php-fpm 是必须尝试的。
对于当前的 apache 稳定版本 (2.2),如果您想在 chroot 模式下使用它,您将会遇到问题。但您可以尝试 apache 2.3 或等待 2.4 并使用 mod_proxy_fastcgi 而不是 mod_fastcgi 或其他。您还可以使用此版本的 Apache 测试新事件 basef mpm。或者当然您可以尝试@petermolnar 回答的其他网络服务器
You could use Apache in worker mode if you do not use PHP with mod_php. Use PHP in Fastcgi mod, php-fpm is a must-try for that.
With current apache stable version (2.2) you will have problems if you want to use it in chrooted mode. But you may try apache 2.3 or wait for the 2.4 and use mod_proxy_fastcgi instead of mod_fastcgi or others. You could also test the new event basef mpm with this version of Apache. Or of course you could try the other web servers as answered by @petermolnar