polygraph初体验

源码安装过程就不说了!


配置文件simple.pg

/*
 * A very simple "Hello, World!" workload
 */

// this is just one of the simplest workloads that can produce hits
// never use this workload for benchmarking

Content cntHTTP_flv= {
        kind = "HTTP_FLV"; // just a label
        mime = { type =  undef(); prefixes = ["flv_pgclient/"]; extensions = [ ".flv" ]; };
        size = exp(3MB);
        cachable = 10%;
};
Content cntHTTPKB_html = {
        kind = "HTTP_HTML"; // just a label
        mime = { type =  undef(); prefixes = ["htm_pgclient/"]; extensions = [ ".html" ]; };
        size = exp(20KB);
        cachable = 10%;
};

// a primitive server cleverly labeled "S101"
// normally, you would specify more properties,
// but we will mostly rely on defaults for now
Server S = {
	kind = "S101"; 
	contents = [ cntHTTP_flv: 50%, cntHTTPKB_html: 50% ];
	direct_access = contents;

	//发送的web server主机地址(我的是本机的上的web server,端口是8002)
	addresses = ['127.0.0.1:8002' ]; // where to create these server agents
};

// a primitive robot
// client端配置
Robot R = {
	kind = "R101";
	pop_model = { pop_distr = popUnif(); };
	recurrence = 55% / cntHTTP_flv.cachable; // adjusted to get 55% DHR
	req_rate = 20/sec;	//每个线程发送的tps

	origins = S.addresses;      // where the origin servers are

	//启动的发送线程数5
	addresses = ['127.0.0.1' ** 5 ]; // where these robot agents will be created
};

// commit to using these servers and robots
use(S, R);


web server用nginx,这个需要在nginx.conf中配置重写

#rewrite about polygraph
rewrite "^(/htm_pgclient)" /aaaxxxx.html;
rewrite "^(/flv_pgclient)" /aaaxxxx.flv;


执行命令:

./polygraph-client --cfg_dirs ../share/polygraph/workloads/include/ --config ../share/polygraph/workloads/simple.pg --verb_lvl 10 --log a.log --proxy 192.168.1.109:3128  >>/dev/null


这个用squid代理测试,这里看squid的access.log日志!

1340870692.427      0 127.0.0.1 TCP_MISS/200 41825 GET http://127.0.0.1:8002/htm_pgclient/w198ac59f.578c5061:00000008/t04/_0000056b.html - DIRECT/127.0.0.1 text/html
1340870692.448     16 127.0.0.1 TCP_MISS/200 2922380 GET http://127.0.0.1:8002/flv_pgclient/w198ac59f.578c5061:00000008/t03/_0000056c.flv - DIRECT/127.0.0.1 video/x-flv
1340870692.494      1 127.0.0.1 TCP_MISS/200 41825 GET http://127.0.0.1:8002/htm_pgclient/w198ac59f.578c5061:00000008/t04/_0000056e.html - DIRECT/127.0.0.1 text/html
1340870692.503     23 127.0.0.1 TCP_MISS/200 2922380 GET http://127.0.0.1:8002/flv_pgclient/w198ac59f.578c5061:00000008/t03/_0000056d.flv - DIRECT/127.0.0.1 video/x-flv
1340870692.578      1 127.0.0.1 TCP_MISS/200 41825 GET http://127.0.0.1:8002/htm_pgclient/w198ac59f.578c5061:00000008/t04/_0000056f.html - DIRECT/127.0.0.1 text/html
1340870692.623     21 127.0.0.1 TCP_MISS/200 2922380 GET http://127.0.0.1:8002/flv_pgclient/w198ac59f.578c5061:00000008/t03/_00000570.flv - DIRECT/127.0.0.1 video/x-flv
1340870692.636      0 127.0.0.1 TCP_MISS/200 41825 GET http://127.0.0.1:8002/htm_pgclient/w198ac59f.578c5061:00000008/t04/_00000571.html - DIRECT/127.0.0.1 text/html
1340870692.643      1 127.0.0.1 TCP_MISS/200 41825 GET http://127.0.0.1:8002/htm_pgclient/w198ac59f.578c5061:00000008/t04/_00000572.html - DIRECT/127.0.0.1 text/html
1340870692.647      0 127.0.0.1 TCP_MISS/200 41825 GET http://127.0.0.1:8002/htm_pgclient/w198ac59f.578c5061:00000008/t04/_00000573.html - DIRECT/127.0.0.1 text/html
1340870692.698     21 127.0.0.1 TCP_MISS/200 2922380 GET http://127.0.0.1:8002/flv_pgclient/w198ac59f.578c5061:00000008/t03/_00000574.flv - DIRECT/127.0.0.1 video/x-flv
1340870692.700      0 127.0.0.1 TCP_MISS/200 41825 GET http://127.0.0.1:8002/htm_pgclient/w198ac59f.578c5061:00000008/t04/_00000575.html - DIRECT/127.0.0.1 text/html
1340870692.707      0 127.0.0.1 TCP_MISS/200 41825 GET http://127.0.0.1:8002/htm_pgclient/w198ac59f.578c5061:00000008/t04/_00000576.html - DIRECT/127.0.0.1 text/html


看样子是测试成功了!


其实polygraph自己提供了web server,我这里没用!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值