分类: LINUX
2009-02-06 18:03:11
1.比较现有T2000 Apache2.2.8经过优化前后的效果
Webserver IP:10.56.234.31
优化前httpd.conf:
----------------------------------------------------------------------
StartServers 10
MinSpareServers 50
MaxSpareServers 100
ServerLimit 10000
MaxClients 10000
MaxRequestsPerChild 0
----------------------------------------------------------------------
优化后httpd.conf:
----------------------------------------------------------------------
StartServers 150
MinSpareServers 10
MaxSpareServers 20
ServerLimit 20000
MaxClients 20000
MaxRequestsPerChild 10000
----------------------------------------------------------------------
测试命令: /opt/apache2.2.8/bin/ab -n 10000 -c 1000
测试方法: 访问20kb的jpg图片来获取tps数据,为了排除网络因素,选取127.0.0.1本地环路地址。
测试结果:
----------------------------------------------
使用ApacheBench v2.0进行测试
apache2.2.8(20k) 优化前 1657tps
apache2.2.8(20k) 优化后 1666tps
---------------------------------------------
使用 ApacheBench v2.3进行测试
apache2.2.8(20k) 优化前 1765tps
apache2.2.8(20k) 优化后 1822tps
-----------------------------------------------
测试结论:由于这个Apache2.2.8版本没有编入worker.c模块,无法进行worker优化。但是,单独就对prefork的优化,发现性能提升很小。基本保持以后的水平。同时我们发现,测试结果受到T2000机器状态影响很大。所以,本测试基本在没有其他压力的情况下进行。
2.比较现有T2000上Apache2.2.8和Apache2.2.11优化后的性能
Webserver IP:10.56.234.31
配置:
a. Apache2.2.8优化后配置请见step1
b.Apache2.2.11中对于httpd-mpm.conf优化:
----------------------------------------------------------------------
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
StartServers 150
MinSpareServers 10
MaxSpareServers 20
ServerLimit 20000
MaxClients 20000
MaxRequestsPerChild 10000
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
StartServers 2
MaxClients 1500
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
同时在httpd.conf中打开httpd-mpm.conf注释。在编译Apache2.2.11的worker模块时修改了worker源代码,
# vi server/mpm/worker/worker.c
找到下面几行,并改成如下的数值,其目的是在源码中修改apache可支持的最大线程数和最大客户端数目。
# define DEFAULT_SERVER_LIMIT 256
# define MAX_SERVER_LIMIT 40000
# define DEFAULT_THREAD_LIMIT 256
# define MAX_THREAD_LIMIT 40000
----------------------------------------------------------------------
测试命令:
/opt/apache2.2.8/bin/ab -n 10000 -c 1000
/opt/apache2.2.8/bin/ab -n 10000 -c 1000
/opt/apache2.2.11/bin/ab -n 10000 -c 1000
/opt/apache2.2.11/bin/ab -n 10000 -c 1000
测试方法: 访问20kb的jpg图片来获取tps数据,为了排除网络因素,选取127.0.0.1本地环路地址。
测试结果:
-----------------------------------------------
使用ApacheBench v2.0进行测试
apache2.2.8(20k) 1631tps
apache2.2.11(20k) 1581tps
-----------------------------------------------
----------------------------------------------
使用ApacheBench v2.3进行测试
apache2.2.8(20k) 1773tps
apache2.2.11(20k) 1747tps
----------------------------------------------
测试结论:
Apache2.2.8和Apache2.2.11经过优化后的测试结果相近。
3.比较CMCC的机遇HP Blade的Apache2.0.52的性能
Webserver IP:10.56.135.64
优化配置:同step2中Apache2.2.11配置
测试命令:
/opt/apache2.2.8/bin/ab -n 10000 -c 1000
/usr/bin/ab -n 10000 -c 1000
测试方法:访问20kb的jpg图片来获取tps数据,为了排除网络因素,选取127.0.0.1本地环路地址。
测试结果:
-----------------------------------------------
使用ApacheBench v2.0.1.141进行测试
Apache2.0.52(20k) 3773tps
-----------------------------------------------
----------------------------------------------
使用ApacheBench v2.0.1.146进行测试
Apache2.0.52(20k) 7556tps
----------------------------------------------
测试结论:测试工具的版本差异会造成结果的巨大差异。但是,总的来说,CMCC HP Blade webserver性能在此项测试中要优于T2000 Webserver。初步怀疑是硬件系统架构差异引起的性能差异。