Varnish VS Nginx测试报告
1:配置情况
nginx机器配置:
CPU: E7500 @ 2.93GHz (双核)
内存:4G
varnish机器配置:
CPU: E3300 @ 2.50GHz (双核)
内存:2G
测试脚本执行机器配置:
CPU: AMD Phenom(tm) II X4 925 Processor
内存:2G
2:测试准备工作
2.1:安装siege
使用压力测试工具siege(http://www.joedog.org/index/siege-home) 来验证。可以根据路径来并发重复压力测试。安装方式:
下载:wget ftp://sid.joedog.org/pub/siege/siege-latest.tar.gz
安装:
#./configure
#make && make install
[root@localhost test] siege -c 100 -r 100 -f varnish_url.txt [root@localhost test] siege -c 100 -r 100 -f nginx_url.txt
参数说明:
-c 100 并发100个用户
-r 100 重复循环100次
-f varnish_url.txt 任务列表:URL列表
2.2:构造URL
构造了536个url测试,其中1个是错误的url。
到测试机器上,
[root@localhost test] cd /data/htdocs/resources/web [root@localhost test] find . -name "*.jpg" -print > varnish_url.txt
2.3:开启nginx图片缓存方法
开启nginx的缓存图片的方法,在nginx的conf中添加:
location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf|ico)$ { expires 30d; access_log off; }
3:运行后测试结果:
3.1.1:nginx不带缓存的情况
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 65.83 secs
Data transferred: 260.83 MB
Response time: 0.01 secs
Transaction rate: 151.91 trans/sec
Throughput: 3.96 MB/sec
Concurrency: 2.06
Successful transactions: 9900
Failed transactions: 0
Longest transaction: 3.03
Shortest transaction: 0.00
3.1.2:nginx带缓存的情况
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 63.90 secs
Data transferred: 266.10 MB
Response time: 0.01 secs
Transaction rate: 156.49 trans/sec
Throughput: 4.16 MB/sec
Concurrency: 2.18
Successful transactions: 9900
Failed transactions: 0
Longest transaction: 0.35
Shortest transaction: 0.00
3.1.3:nginx带缓存第二次测试的情况
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 63.05 secs
Data transferred: 266.10 MB
Response time: 0.01 secs
Transaction rate: 158.60 trans/sec
Throughput: 4.22 MB/sec
Concurrency: 2.06
Successful transactions: 9900
Failed transactions: 0
Longest transaction: 0.34
Shortest transaction: 0.00
3.2.1:varnish清空缓存第一次测试情况
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 62.87 secs
Data transferred: 266.10 MB
Response time: 0.01 secs
Transaction rate: 159.06 trans/sec
Throughput: 4.23 MB/sec
Concurrency: 1.95
Successful transactions: 9900
Failed transactions: 0
Longest transaction: 0.37
Shortest transaction: 0.00
3.2.2:varnish有缓存测试
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 61.91 secs
Data transferred: 266.10 MB
Response time: 0.01 secs
Transaction rate: 161.52 trans/sec
Throughput: 4.30 MB/sec
Concurrency: 1.78
Successful transactions: 9900
Failed transactions: 0
Longest transaction: 0.34
Shortest transaction: 0.00
3.2.3:varnish负责均衡性能
Transactions: 10000 hits
Availability: 100.00 %
Elapsed time: 59.75 secs
Data transferred: 266.10 MB
Response time: 0.01 secs
Transaction rate: 167.36 trans/sec
Throughput: 4.45 MB/sec
Concurrency: 1.98
Successful transactions: 9900
Failed transactions: 0
Longest transaction: 3.01
Shortest transaction: 0.00
4:结论
建议继续学习:
- 配置Nginx+uwsgi更方便地部署python应用 (阅读:105407)
- 搜狐闪电邮箱的 Nginx/Postfix 使用模式 (阅读:32532)
- 解析nginx负载均衡 (阅读:14527)
- Nginx模块开发入门 (阅读:9888)
- 检查nginx配置,重载配置以及重启的方法 (阅读:9109)
- Cacti 添加 Nginx 监控 (阅读:8925)
- Nginx+FastCgi+Php 的工作机制 (阅读:8862)
- nginx的配置文件 (阅读:8838)
- 奇怪的 Nginx 的 upstream timed out 引起响应 502 (阅读:8167)
- 解决IE6从Nginx服务器下载图片不Cache的Bug (阅读:7110)
扫一扫订阅我的微信号:IT技术博客大学习
- 作者:longhao 来源: 龙浩的blog
- 标签: Nginx Varnish
- 发布时间:2011-10-17 22:40:15
- [44] 界面设计速成
- [39] Oracle MTS模式下 进程地址与会话信
- [39] 视觉调整-设计师 vs. 逻辑
- [35] 如何拿下简短的域名
- [35] 程序员技术练级攻略
- [35] IOS安全–浅谈关于IOS加固的几种方法
- [33] 图书馆的世界纪录
- [33] android 开发入门
- [32] 【社会化设计】自我(self)部分――欢迎区
- [30] 读书笔记-壹百度:百度十年千倍的29条法则