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应用 (阅读:105510)
- 搜狐闪电邮箱的 Nginx/Postfix 使用模式 (阅读:32622)
- 解析nginx负载均衡 (阅读:14786)
- Nginx模块开发入门 (阅读:10061)
- 检查nginx配置,重载配置以及重启的方法 (阅读:9269)
- Cacti 添加 Nginx 监控 (阅读:9016)
- Nginx+FastCgi+Php 的工作机制 (阅读:9003)
- nginx的配置文件 (阅读:8975)
- 奇怪的 Nginx 的 upstream timed out 引起响应 502 (阅读:8442)
- 解决 nginx 反向代理网页首尾出现神秘字符的问题 (阅读:7222)
扫一扫订阅我的微信号:IT技术博客大学习
- 作者:longhao 来源: 龙浩的blog
- 标签: Nginx Varnish
- 发布时间:2011-10-17 22:40:15
- [363] QR码分析
- [352] 最常见的电话号码
- [64] 面向移动设备的HTML5开发框架梳理
- [59] 如何拿下简短的域名
- [59] Go Reflect 性能
- [58] 图书馆的世界纪录
- [56] Twitter/微博客的学习摘要
- [54] Oracle MTS模式下 进程地址与会话信
- [52] android 开发入门
- [52] IOS安全–浅谈关于IOS加固的几种方法