Chinaunix首页 | 论坛 | 博客
  • 博客访问: 28635
  • 博文数量: 10
  • 博客积分: 156
  • 博客等级: 入伍新兵
  • 技术积分: 70
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-12 22:22
文章分类
文章存档

2012年(1)

2011年(9)

分类:

2011-11-09 18:35:07

原文地址:LAMP LNMP性能测试 作者:sjhf

前几天做了个nginx+php-FastCGI+mysql的性能测试,正好这两天没事,索性延伸了一下,做了个小小的对比。
 
我管nginx+php-FastCGI+mysqlLNMP了。
 
硬件环境:VMware虚拟的CentOS_v5.2CPUE7200 分了一个cpu、内存400MB DDR2-800
测试结果:
测试结果说明:
测试软件还是phpspeed,命令行的那个还没学会。呵呵。
mysql都在默认配置基础增加query_cache_size=4M,上篇文章说增加好多倍的就是这里,不开的时候只有2k-3k。
方案1:apache(fastcgi)+php(fastcgi)+mysql   mysql用rpm安装,其余编译安装。
方案2:nginx+php(fastcgi)+mysql   用rpm安装,其余编译安装。
方案3:apache+php+mysql   全部rpm安装。
项目1-6就是phpspeed里面的那6个项目,分别为:
Synthetic PHP、Synthetic MySQL、Synthetic Read/Write
Real World PHP、Real World PHP & MySQL
Server Benchmark
 
附录:
方案1环境配置过程:
1. rpm安装mysql、msyql-devel
2. 编译安装apache2.2.x
3. 编译安装phpphp-5.2.8.tar.gz:
#tar zxf php-5.2.8.tar.gz
#cd php-5.2.8
#./configure --prefix=/usr/local/php -enable-fastcgi --enable-force-cgi-redirect --with-#mysql=/usr/lib/mysql --with-openssl
#make && make install
修改php.ini,打开output_buffering=4096,不然会有问题。
4. 编译安装mod_fastcgi-2.4.6:
#tar zxf mod_fastcgi-2.4.6.tar.gz
#cd mod_fastcgi-2.4.6
如果web服务器是apache2
#cp Makefile.AP2 Makefile
#vi Makefile
把top_dir = /你的apache2的安装目录(默认是/usr/local/apache2)
#make && make install
安装好以后在apache的 modules 目录下会有一个mod_fastcgi.so
5. 编译安装fcgi-2.4.0.tar.gz
#tar zxf fcgi-2.4.0.tar
#cd fcgi-2.4.0
#./configure
#make && make install
 
6. 在http.conf中加入:
LoadModule fastcgi_module modules/mod_fastcgi.so
.Alias /fcgi-bin/ "/usr/local/php/bin/"
AddHandler php-fastcgi .php
Action php-fastcgi /fcgi-bin/php-cgi
AddType application/x-httpd-php .php

    Options FollowSymLinks ExecCGI
    AllowOverride None
    Order allow,deny
    allow from all
 
7. 检查:
放个test.php到主目录,看看是下载还是显示phpinfo。
php的fastcgi成功的话phpinfo里面会有Server API=CGI/FastCGI这么一行。
apache的mod_fastcgi会在运行phpspeed时看到。
 

阅读(971) | 评论(0) | 转发(0) |
0

上一篇:LINUX下的iptables

下一篇:LAMP过渡到LNMP

给主人留下些什么吧!~~