嗨,似乎我的服务器无法处理繁忙时间的stream量和Apache似乎只是崩溃。
以下是服务器上的一些信息:
4Gb公羊
Windows 2003 Server
它也运行着像Mediawiki,Joomla,Wordpress和Drupal这样的PHP应用程序,每天的点击量是18K。
这里有一些来自httpd.conf的重要configuration:
# Timeout: The number of seconds before receives and sends time out. # Timeout 300 # # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to "Off" to deactivate. # KeepAlive On # # MaxKeepAliveRequests: The maximum number of requests to allow # during a persistent connection. Set to 0 to allow an unlimited amount. # We recommend you leave this number high, for maximum performance. # MaxKeepAliveRequests 100 # # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # KeepAliveTimeout 15 ## ## Server-Pool Size Regulation (MPM specific) ## # WinNT MPM # ThreadsPerChild: constant number of worker threads in the server process # MaxRequestsPerChild: maximum number of requests a server process serves MaxClients 125 #<ifModule mpm_common> #MaxClients 140 #</IfModule> <IfModule mpm_winnt.c> ThreadsPerChild 250 MaxRequestsPerChild 0 </IfModule> ### END
以下是php.ini中的eAcceleratorconfiguration:
[eAccelerator] extension="eaccelerator.dll" eaccelerator.shm_size="64" eaccelerator.cache_dir="C:\Temp\eaccelerator" eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="0" accelerator.shm_prune_period="0" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9" eaccelerator.keys = "shm" eaccelerator.sessions = "shm" eaccelerator.content = "shm" eaccelerator.debug="0"
我知道在Windows机器上运行Apache是非常错误的,但是我暂时不得不忍受这一点(不幸的是,我不打电话)。
我的configuration有问题吗? 有没有解决scheme,以便服务器可以处理负载? 任何帮助,将不胜感激。 提前致谢!
Apache不是你的问题; 它会处理大量的负载,而无需任何调整。 这是你的应用程序(也可能是你的数据库)。 对于预先打包的PHP应用程序中糟糕的代码,您可以做的事情不多,但是在数据库调优和模式方面进行大量工作的情况并不多见。 我会首先在那里寻找(logging和优化慢速查询,调整数据库内存使用情况以适应工作负载和可用内存等)。
在Windows下,最好的办法是使用IIS和fastCGI。 这使您可以回收CGI过程,而不会让它们运行。 这可能是杀害性能。 IIS团队有安装fastCGI的指南
对于Windows,为什么不采取像WAMP这样的打包工具?
WampServer 2.0h [04/16/09] Includes : Apache 2.2.11, MySQL 5.1.33, PHP 5.2.9-2
您可以更改版本并运行其中任何一个的多个实例。
虽然,我自己也没有尝试过。
此外,还有一个便携版 。
这可能是您在Unix安装时遇到的解决scheme。
你真的需要找出系统的哪一部分是这里的瓶颈。 尝试将服务分解到不同的硬件上,或者至less在缓慢的应用程序中插入一些分析。
然而,随机猜测,请检查您的数据库是否正确使用索引 – 启用慢查询日志logging,并查看您得到多less缓慢的查询。 一般不应该太多; 太多缓慢的查询会导致Apache在等待PHP进程完成时停顿。
调整apache中fastcgi进程的最大数量。 听起来就像它使用了太多的内存(最大进程数* php内存限制),并在无休止地交换时死亡。 不要将apache进程/线程的数量与fastcgi / php进程的数量混淆。