当压力测试并发达1000时,内存基本消耗完,并发数再加上去就会死机,数据库服务器压力不大,有使用文件缓存,数据量比较大,有xcache
环境:
PHP Version 5.2.6System  Linux bogon 2.6.18-92.el5xen #1 SMP Tue Apr 29 13:31:30 EDT 2008 x86_64
Build Date  Aug 5 2009 17:51:16
Configure Command  './configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-mysql=/usr/local/mysql'
Server API  Apache 2.0 Handler
Virtual Directory Support  enabled
Configuration File (php.ini) Path  /usr/local/php/lib
Loaded Configuration File  /usr/local/php/lib/php.ini
PHP API  20041225
PHP Extension  20060613
Zend Extension  220060519
Debug Build  no
Thread Safety  enabled
Zend Memory Manager  enabled
IPv6 Support  enabled
Registered PHP Streams  php, file, data, http, ftp
Registered Stream Socket Transports  tcp, udp, unix, udg
Registered Stream Filters  string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.* 

解决方案 »

  1.   

    PS:memory_get_usage();每个进程的内存是379816左右,
        服务器内存4G,初始值大概1G
      

  2.   


    <IfModule mpm_prefork_module>
        StartServers          10
        MinSpareServers       10
        MaxSpareServers      15
        ServerLimit 2000
        MaxClients 1000
        MaxRequestsPerChild   150
    </IfModule>ThreadsPerChild 160
    MaxRequestsPerChild  150
    我这样设置的,物理内存2个G,