我的服务器将托pipe许多PHP Web应用程序,从Joomla,Drupal和一些传统(读取:PHP4)以及从客户端inheritance的其他自定义代码。 这将是一个由十几个Web开发人员使用的开发机器,像波动负载或特别是高负载预期的问题并不重要。
现在,我的问题是:在使用Apache w / MPM Worker,PHP 4 / PHP 5.2 / PHP 5.3(全部通过FastCGI)和MySQL 5(查询caching为64MB)时,我应该了解哪些问题?
我没有广泛地testing各种应用程序,最近我才学会如何安装PHP,并通过FastCGI(而不是mod_php,在这种情况下似乎是不可能的(考虑到PHP的多个版本以及使用MPM Worker而不是MPM prefork)的)。
我已经了解到,XCache和APC可能存在一些问题,即非线程安全问题,即数据被破坏,使用MPM Worker的能力变得无效。 这是一个有效的关注吗?
我一直在使用我的个人testing服务器(在VirtualBox中运行Ubuntu Server版本10.04),它有2GB的RAM可用。
以下是使用的configuration(实际的服务器可能会使用更适合其用途的configuration):
阿帕奇:
Server version: Apache/2.2.14 (Ubuntu) Server built: Apr 13 2010 20:22:19 Server's Module Magic Number: 20051115:23 Server loaded: APR 1.3.8, APR-Util 1.3.9 Compiled using: APR 1.3.8, APR-Util 1.3.9 Architecture: 64-bit Server MPM: Worker threaded: yes (fixed thread count) forked: yes (variable process count)
工人:
<IfModule mpm_worker_module> StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxClients 400 MaxRequestsPerChild 2000 </IfModule>
PHP ./configure(PHP 4.4.9,PHP 5.2.13,PHP 5.3.2):
--enable-bcmath \ --enable-calendar \ --enable-exif \ --enable-ftp \ --enable-mbstring \ --enable-pcntl \ --enable-soap \ --enable-sockets \ --enable-sqlite-utf8 \ --enable-wddx \ --enable-zip \ --enable-fastcgi \ --with-zlib \ --with-gettext \
Apache的PHP-fastcgi-setup.conf
FastCgiServer /var/www/cgi-bin/php-cgi-5.3.2 FastCgiServer /var/www/cgi-bin/php-cgi-5.2.13 FastCgiServer /var/www/cgi-bin/php-cgi-4.4.9 ScriptAlias /cgi-bin-php/ /var/www/cgi-bin/
你应该问自己唯一的问题是:你真的期望在你的网站上有这么多的stream量来保证这样一个复杂和风险的设置(而不是“普通的”prefork + php作为一个模块)。
我一直在运行一些php重量级网站,每天点击10米以上,而不需要切换到线程模型。 PHP本身是一团糟,使得它跳起来,要求它。
我不能同意上面的答案。 这与您期望的stream量无关,而是可以创造多lessstream量。 除非你喜欢有任何歹徒可以随时closures的服务,否则你必须devise它来承受比一般歹徒所能创造的更多的负担。