9月 152014
 

最近将Nginx从1.60升级到1.61,然后发现php不能解析了。
切换回Apache,工作正常,说明不是php5-fpm的问题,而确实是nginx出问题了。

生产环境,若要稳定,还是apache比较好,很多年了从来没有出现类似的问题。
但是nginx的性能是有目共睹的。

回到正题,google了一下,解决办法如下: Continue reading »

6月 172014
 

Time is money. This somewhat shallow and overused saying fits perfectly well into any on-line business. Users are impatient and every millisecond brings them closer to leaving your website.

If you’ve ever been trying to squeeze more out of hardware you must have come across Nginx (engine x). Nginx usually appears in context of PHP-FPM (FastCGI Process Manager) and APC (Alternative PHP Cache). This setup is often pitched to be the ultimate combo for a web server but what that really means? How much faster a PHP application is going to be on a different web server? I had to check it and the answer as often is – that depends.

I benchmarked three different types of PHP software:

– Large application based on Zend Framework 1
– Small PHP script
– WordPress

The software was hosted on Amazon EC2 large instance. All benchmarks were run from EC2 Tiny instance to be as close as it possible to the web server.

To make sure I benchmark web servers instead of disk I/O I set all logs to go to memory (/dev/shm). PHP sessions were directed to memcached.
Both servers were using Zend Optimizer Plus with opcache.revalidate_freq set to 1 hour. I use Zend Optimizer because APC wasn’t stable for me with PHP 5.4.x.
If you aren’t familiar with PHP accelerators they convert PHP scripts into byte code and keep them in shared memory. That brings significant boost of performance (40-90%) because PHP scripts don’t have to be read from a disc and parsed on every request. Using the accelerator helped me removing I/O from the equation.

It’s very important to make sure Apache won’t read .htaccess. You can achieve it by setting Allow Overwrite to none. Parsing htaccess in real time will drop performance on the Apache side. It’s recommended to not use this file in production environment. Continue reading »

10月 152011
 

话说nginx在大压力的环境中比apache的表现要好,于是下载了一个来折腾一下。

下载并编译安装,我的编译过程有点特别:

1。去除调试信息,修改$nginx_setup_path/auto/cc/gcc这个文件,将 CFLAGS=”$CFLAGS -g”  这一行注释掉。

2。由于仅测试WEB服务器的性能,所以不安装FastCGI。 Continue reading »