源码安装过程就不说了!
配置文件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,我这里没用!