ATS
安装
官网文档如其配置一样比较简洁,条理(代码怎么样待看了。。)
下载,安装依赖包,然后编译到大硬盘下:
./configure --prefix=/home1/huanglq/ats
make; make install;
配置
vi etc/trafficserver/remap.config|
map http://10.1.72.102 http://10.1.72.99
map http://10.1.72.102/myCI/ http://127.0.0.1 @action=allow @src_ip=10.1.84.241
vi etc/trafficserver/records.config
CONFIG proxy.config.url_remap.pristine_host_hdr INT 0
CONFIG proxy.config.cache.ram_cache.size INT 8589934592
这两个一直失效:
CONFIG proxy.config.http_ui_enabled INT 1
CONFIG proxy.config.socks.http_port INT 8080
vi etc/trafficserver/storage.config
var/trafficserver 300G
启动
开始启动失败,因为使用了80端口,如果使用1024端口以下的必须root权限。
因此sudo启动,但是发现绑定80成功还是启动不了,后面发现它拉起端口后使用nobody用户来跑程序,因此必须给nobody文件全系
chmod -R 777 *
然后 bin/trafficserver start启动成功了。
使用ATS的过程中可以,可以通过line和shell来查看状态。用shell的show:cache-stats直观点吧。
测试
26G的图片,RAM 8G,保证3W个sample都在保证缓存都在RAM时的测试结果
217KB图片,1~3个进程同时压测的
tranf/s: 319, 461,478
MB: 67~103MB/s
响应速度3~6ms
14KB图片,1、3进程压测
tranf/s:348, 483
MB: 4.8~6.8MB/s
响应速度3~6ms
测试的过程中ATS的CPU没有上过30%
换siege用20个线程压测同一个URL:
13K IMG
源:
Transaction rate: 4298.06 trans/sec
Throughput: 57.70 MB/sec
ATS:
Transaction rate: 16573.52 trans/sec
Throughput: 222.51 MB/sec
217K IMG
ATS:
Transaction rate: 9165.96 trans/sec
Throughput: 1946.41 MB/sec
-==========================================
RAW盘:
Throughput: 8.39 MB/sec
大文件缓存方式:
Transaction rate: 37.88 trans/sec
Throughput: 14.34 MB/sec
Transaction rate: 38.36 trans/sec
Throughput: 2.33 MB/sec
相应的ng性能:
Transaction rate: 40.22 trans/sec
Throughput: 2.44 MB/sec
Transaction rate: 42.11 trans/sec
Throughput: 2.55 MB/sec
相应的顺序读磁盘:
sysbench --test=fileio --num-threads=10 --file-num=10000 --file-block-size=8K --file-total-size=2240000K --file-test-mode=seqrd run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Operations performed: 280000 Read, 0 Write, 0 Other = 280000 Total
Read 2.1362Gb Written 0b Total transferred 2.1362Gb (20.328Mb/sec)
2602.02 Requests/sec executed
这个测试数据明显反复读了,缓存生效,
在随机读测试的时候是读1.3Mb/sec
压测的过程中记得为了避免time_wait错误
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_timestamps=1
net.ipv4.tcp_tw_recycle=1
sudo /sbin/sysctl -e -p /etc/sysctl.conf
400个并发下:
ng
62K
同一文件:
Transaction rate: 1783.45 trans/sec
Throughput: 108.12 MB/sec
ats
清空缓存随机读
Transaction rate: 234.60 trans/sec
Throughput: 14.22 MB/sec
再次随机读
Transaction rate: 257.73 trans/sec
Throughput: 15.62 MB/sec
Transaction rate: 281.62 trans/sec
Transaction rate: 294.71 trans/sec
Throughput: 17.87 MB/sec
(17.07-15.62)/15.62 = 9%
RAW 60W 39G数据随机读(是否drop_caches没区别)
Transaction rate: 207.66 trans/sec
Throughput: 12.59 MB/sec
140W 91G数据
Transaction rate: 196.99 trans/sec
Throughput: 11.94 MB/sec
140W 91G数据大文件cache.db
Transaction rate: 182.82 trans/sec
Throughput: 11.08 MB/sec
相同文件:
Transaction rate: 13752.11 trans/sec
Throughput: 833.68 MB/sec
1个并发:
ATS
Transaction rate: 2270.30 trans/sec
Throughput: 137.63 MB/sec
NG
Throughput: 35.41 MB/sec
Transaction rate: 747.84 trans/sec
Throughput: 45.34 MB/sec