您的位置:首页 > 其它

web-polygraph源码框架和session处理流程笔记

2014-05-14 17:28 519 查看
description:

web-polygraph是一个很好很强大的测试工具,连微软这些公司都在用!现在开源只能下载4.3.2。下面一些看代码的笔记,
和squid主流程都差不多,都是单进程单线程模式的东西:
squid main loop:
initialize();/*初始化*/
while(true) {
timer_run();/*处理定时器*/
do_event_io(wait_sec);/*处理IO请求, epoll_wait方式*/
}

timer:

class AlarmClock: public Clock

AlarmClock TheAlarmClock; /*定时器heap*/

Clock TheClock; /*当前时间*/


main loop:

while(true) {

scan(); /*处理IO请求, epoll_wait方式*/

Clock::Update();/*处理定时器*/

}


scan(); /*处理IO请求, epoll_wait方式*/:

{

hotCount = sweep(timeout); /*epoll_wait方式返回*/
for (int idx = 0; idx < hotCount; ++idx) {
int fd;
if (readyUser(idx, dirRead, fd)) { /*return ready read user*/
theRegs[fd].notifyReadReady(fd); /*handle read io event*/
}
if (readyUser(idx, dirWrite, fd)) { /*return write read user*/
theRegs[fd].notifyWriteReady(fd);/*handle write io event*/
}
}
}
response process state flow:

enum State { stNone = 0, stConnWaiting, stSpaceWaiting, stHdrWaiting, stBodyWaiting, stDone };

request session process step:

1 Create robot agents(AsynClt);
2 Add robot agents to Timer Queue for scheduling;
3 Wake up robot agents(AsynClt) from Timer Queue and launch this http session;
4 Generate ObjId object and CltXact ;
5 Create CltXact object connection;
6 Add CltXact connection fd-write event to epoll ctl manager;
7 Write io event handle -> build request;
8 Write io event handle -> send request;
9 write io event handle -> after send request, add read event to epoll manager;
10 Read io event handle -> after send request, read response;
11 Read io event handle -> after read response, parse response header;
12 Read io event handle -> after read response, get response body complete;
13 Read io event handle -> transaction over and check if retry request.

create robot agents(AsynClt), the client number is determined by pgl config file:

pgl config file: addresses = ['127.0.0.1' ** 2 ]; // where these robot agents will be created

(gdb) bt
bt
#0 Agent::Agent (this=0x8253c40) at Agent.cc:24
#1 0x08050c2e in Client::Client (this=0x8253c40) at Client.cc:78
#2 0x0805af2c in AsyncClt::AsyncClt (this=0x8253c40, aThinkDistr=0x822ef00) at AsyncClt.cc:15
#3 0x0804cf91 in PolyClt::makeAgent (this=0xbffffa24, agent=..., address=...) at PolyClt.cc:74
#4 0x08094a53 in PolyApp::makeAgents (this=0xbffffa24) at PolyApp.cc:731
#5 0x08096586 in PolyApp::run (this=0xbffffa24, argc=13, argv=0xbffffb74) at PolyApp.cc:1022
#6 0x0804dff8 in main (argc=13, argv=0xbffffb74) at PolyClt.cc:276
add robot agents(AsynClt) to Timer Queue for scheduling:

the first time:
(gdb) bt
bt
#0 AlarmClock::setAlarm (this=0x82058c0 <TheAlarmClock>, alarm=...) at AlarmClock.cc:81
#1 0x08141cdb in AlarmUser::sleepTill (this=0x8231abc, time=...) at AlarmClock.cc:58
#2 0x0805b21e in AsyncClt::scheduleLaunch (this=0x8231a58, lastLaunch=...) at AsyncClt.cc:55
#3 0x080519dc in Client::becomeBusy (this=0x8231a58) at Client.cc:196
#4 0x080518a3 in Client::start (this=0x8231a58) at Client.cc:172
#5 0x0804d707 in PolyClt::startClients (this=0xbffffa24, count=0) at PolyClt.cc:169
#6 0x0804dc99 in PolyClt::step (this=0xbffffa24) at PolyClt.cc:228
#7 0x08096689 in PolyApp::run (this=0xbffffa24, argc=13, argv=0xbffffb74) at PolyApp.cc:1060
#8 0x0804dff8 in main (argc=13, argv=0xbffffb74) at PolyClt.cc:276
the next time:
(gdb) bt
bt
#0 AlarmClock::setAlarm (this=0x82058c0 <TheAlarmClock>, alarm=...) at AlarmClock.cc:81
#1 0x08141cdb in AlarmUser::sleepTill (this=0x823e8bc, time=...) at AlarmClock.cc:58
#2 0x0805b21e in AsyncClt::scheduleLaunch (this=0x823e858, lastLaunch=...) at AsyncClt.cc:55
#3 0x0805b06a in AsyncClt::wakeUp (this=0x823e858, a=...) at AsyncClt.cc:33
#4 0x08141b17 in Alarm::ring (this=0xbffff8a4) at AlarmClock.cc:18
#5 0x08141fef in AlarmClock::ring (this=0x82058c0 <TheAlarmClock>) at AlarmClock.cc:100
#6 0x08142070 in AlarmClock::update (this=0x82058c0 <TheAlarmClock>, curTime=...) at AlarmClock.cc:111
#7 0x081432ca in Clock::Update (advanceAll=true) at Clock.cc:46
#8 0x08091029 in PolyApp::step (this=0xbffffa34) at PolyApp.cc:146
#9 0x0804dca4 in PolyClt::step (this=0xbffffa34) at PolyClt.cc:230
#10 0x08096689 in PolyApp::run (this=0xbffffa34, argc=11, argv=0xbffffb84) at PolyApp.cc:1060
#11 0x0804dff8 in main (argc=11, argv=0xbffffb84) at PolyClt.cc:276
wake up robot agents(AsynClt) from Timer Queue and launch this http session, generate ObjId object

(gdb) bt
bt
#0 Client::genOid (this=0x8231a58, oid=...) at Client.cc:491
#1 0x08052c2c in Client::genXact (this=0x8231a58) at Client.cc:485
#2 0x080525a8 in Client::tryLaunch (this=0x8231a58) at Client.cc:371
#3 0x0805b075 in AsyncClt::wakeUp (this=0x8231a58, a=...) at AsyncClt.cc:34
#4 0x08141b17 in Alarm::ring (this=0xbffff894) at AlarmClock.cc:18
#5 0x08141fef in AlarmClock::ring (this=0x82058c0 <TheAlarmClock>) at AlarmClock.cc:100
#6 0x08142070 in AlarmClock::update (this=0x82058c0 <TheAlarmClock>, curTime=...) at AlarmClock.cc:111
#7 0x081432ca in Clock::Update (advanceAll=true) at Clock.cc:46
#8 0x08091029 in PolyApp::step (this=0xbffffa24) at PolyApp.cc:146
#9 0x0804dca4 in PolyClt::step (this=0xbffffa24) at PolyClt.cc:230
#10 0x08096689 in PolyApp::run (this=0xbffffa24, argc=13, argv=0xbffffb74) at PolyApp.cc:1060
#11 0x0804dff8 in main (argc=13, argv=0xbffffb74) at PolyClt.cc:276
generate CltXact object, this a session state object

(gdb) bt
bt
#0 CltXact::CltXact (this=0x8225230) at CltXact.cc:27
#1 0x0806cf1e in HttpCltXact::HttpCltXact (this=0x8225230) at HttpCltXact.cc:45
#2 0x0804f72e in ObjFarm<HttpCltXact>::gen (this=0x823f058) at ../../src/runtime/Farm.h:51
#3 0x0804fda7 in Farm<HttpCltXact>::getDirty (this=0x823f058) at ../../src/runtime/Farm.h:26
#4 0x0804fc82 in Farm<HttpCltXact>::getClean (this=0x823f058) at ../../src/runtime/Farm.h:27
#5 0x0804fadb in Farm<HttpCltXact>::get (this=0x823f058) at ../../src/runtime/Farm.h:28
#6 0x0804f9ba in XactFarmT<CltXact, HttpCltXact>::get (this=0x823f048) at ../../src/runtime/XactFarm.h:32
#7 0x08054efa in Client::getXact (this=0x8231a58, oid=...) at Client.cc:954
#8 0x08052baa in Client::genXact (this=0x8231a58, oid=..., cause=0x0) at Client.cc:472
#9 0x08052c46 in Client::genXact (this=0x8231a58) at Client.cc:486
#10 0x080525a8 in Client::tryLaunch (this=0x8231a58) at Client.cc:371
#11 0x0805b075 in AsyncClt::wakeUp (this=0x8231a58, a=...) at AsyncClt.cc:34
#12 0x08141b17 in Alarm::ring (this=0xbffff894) at AlarmClock.cc:18
#13 0x08141fef in AlarmClock::ring (this=0x82058c0 <TheAlarmClock>) at AlarmClock.cc:100
#14 0x08142070 in AlarmClock::update (this=0x82058c0 <TheAlarmClock>, curTime=...) at AlarmClock.cc:111
#15 0x081432ca in Clock::Update (advanceAll=true) at Clock.cc:46
#16 0x08091029 in PolyApp::step (this=0xbffffa24) at PolyApp.cc:146
#17 0x0804dca4 in PolyClt::step (this=0xbffffa24) at PolyClt.cc:230
#18 0x08096689 in PolyApp::run (this=0xbffffa24, argc=13, argv=0xbffffb74) at PolyApp.cc:1060
#19 0x0804dff8 in main (argc=13, argv=0xbffffb74) at PolyClt.cc:276
create CltXact object connection:

(gdb) bt
bt
#0 Connection::Connection (this=0x8230b00) at Connection.cc:68
#1 0x080a95b4 in ObjFarm<Connection>::gen (this=0x81f91d0 <_ZN7ConnMgr11TheConnFarmE>) at ../../src/runtime/Farm.h:51
#2 0x08068e17 in Farm<Connection>::getDirty (this=0x81f91d0 <_ZN7ConnMgr11TheConnFarmE>) at ../../src/runtime/Farm.h:26
#3 0x08068b8e in Farm<Connection>::getClean (this=0x81f91d0 <_ZN7ConnMgr11TheConnFarmE>) at ../../src/runtime/Farm.h:27
#4 0x08068917 in Farm<Connection>::get (this=0x81f91d0 <_ZN7ConnMgr11TheConnFarmE>) at ../../src/runtime/Farm.h:28
#5 0x08067b2b in CltConnMgr::open (this=0x8231900, hopAddr=..., tcpHopAddr=..., protoStat=NULL, needsSsl=false) at CltConnMgr.cc:126
#6 0x0806793d in CltConnMgr::get (this=0x8231900, oid=..., hopAddr=..., tcpHopAddr=..., protoStat=NULL) at CltConnMgr.cc:102
#7 0x080523d0 in Client::launch (this=0x82319f8, x=0x82377b8) at Client.cc:345
#8 0x080527b9 in Client::tryLaunch (this=0x82319f8, x=0x82377b8) at Client.cc:412
#9 0x080525b7 in Client::tryLaunch (this=0x82319f8) at Client.cc:371
#10 0x0805b075 in AsyncClt::wakeUp (this=0x82319f8, a=...) at AsyncClt.cc:34
#11 0x08141b17 in Alarm::ring (this=0xbffff8a4) at AlarmClock.cc:18
#12 0x08141fef in AlarmClock::ring (this=0x82058c0 <TheAlarmClock>) at AlarmClock.cc:100
#13 0x08142070 in AlarmClock::update (this=0x82058c0 <TheAlarmClock>, curTime=...) at AlarmClock.cc:111
#14 0x081432ca in Clock::Update (advanceAll=true) at Clock.cc:46
#15 0x08091029 in PolyApp::step (this=0xbffffa34) at PolyApp.cc:146
#16 0x0804dca4 in PolyClt::step (this=0xbffffa34) at PolyClt.cc:230
#17 0x08096689 in PolyApp::run (this=0xbffffa34, argc=11, argv=0xbffffb84) at PolyApp.cc:1060
#18 0x0804dff8 in main (argc=11, argv=0xbffffb84) at PolyClt.cc:276
add CltXact connection fd-write event to epoll clt manager:

(gdb) bt
bt
#0 Epoll::setFD (this=0x8226018, fd=14, dir=dirWrite, u=0x8230c60) at Epoll.cc:53
#1 0x080a340a in Connection::HalfPipe::start (this=0x8230b54, u=0x8230c60) at Connection.cc:39
#2 0x08085927 in SingleCxm::control (this=0x8230c60, x=0x82377b8) at SingleCxm.cc:48
#3 0x0806d47e in HttpCltXact::exec (this=0x82377b8, aConn=0x8230b00) at HttpCltXact.cc:118
#4 0x0805250f in Client::launch (this=0x82319f8, x=0x82377b8) at Client.cc:355
#5 0x080527b9 in Client::tryLaunch (this=0x82319f8, x=0x82377b8) at Client.cc:412
#6 0x080525b7 in Client::tryLaunch (this=0x82319f8) at Client.cc:371
#7 0x0805b075 in AsyncClt::wakeUp (this=0x82319f8, a=...) at AsyncClt.cc:34
#8 0x08141b17 in Alarm::ring (this=0xbffff8a4) at AlarmClock.cc:18
#9 0x08141fef in AlarmClock::ring (this=0x82058c0 <TheAlarmClock>) at AlarmClock.cc:100
#10 0x08142070 in AlarmClock::update (this=0x82058c0 <TheAlarmClock>, curTime=...) at AlarmClock.cc:111
#11 0x081432ca in Clock::Update (advanceAll=true) at Clock.cc:46
#12 0x08091029 in PolyApp::step (this=0xbffffa34) at PolyApp.cc:146
#13 0x0804dca4 in PolyClt::step (this=0xbffffa34) at PolyClt.cc:230
#14 0x08096689 in PolyApp::run (this=0xbffffa34, argc=11, argv=0xbffffb84) at PolyApp.cc:1060
#15 0x0804dff8 in main (argc=11, argv=0xbffffb84) at PolyClt.cc:276
write io event handle -> build request:

(gdb) bt
bt
#0 HttpCltXact::makeExplicitReq (this=0x8225230, os=...) at HttpCltXact.cc:398
#1 0x0806e583 in HttpCltXact::makeReq (this=0x8225230, buf=...) at HttpCltXact.cc:354
#2 0x0806baa0 in CltXact::controlledFill (this=0x8225230, needMore=@0x823c654: false) at CltXact.cc:209
#3 0x0806e2a0 in HttpCltXact::controlledFill (this=0x8225230, needMore=@0x823c654: false) at HttpCltXact.cc:308
#4 0x08085b84 in SingleCxm::noteWriteReady (this=0x823c648) at SingleCxm.cc:90
#5 0x0814931a in FileScanUserReg::notifyWriteReady (this=0xb627c104, fd=7) at FileScanner.cc:159
#6 0x08149803 in FileScanner::scan (this=0x8226018, minP=fsupMin, timeout=0xbffff970) at FileScanner.cc:255
#7 0x08096944 in FileScanner::scan (this=0x8226018, tout=0xbffff970) at ../../src/xstd/FileScanner.h:157
#8 0x080911b7 in PolyApp::scan (this=0xbffffa34, toutp=0xbffff970) at PolyApp.cc:160
#9 0x08090e9b in PolyApp::step (this=0xbffffa34) at PolyApp.cc:125
#10 0x0804dca4 in PolyClt::step (this=0xbffffa34) at PolyClt.cc:230
#11 0x08096689 in PolyApp::run (this=0xbffffa34, argc=11, argv=0xbffffb84) at PolyApp.cc:1060
#12 0x0804dff8 in main (argc=11, argv=0xbffffb84) at PolyClt.cc:276
write io event handle -> send request:

(gdb) bt
bt
#0 Socket::write (this=0x8230434, buf=0x8701fd0, sz=...) at Socket.cc:165
#1 0x080a5689 in Connection::rawWrite (this=0x82303a8, ioSz=...) at Connection.cc:541
#2 0x080a46dd in Connection::write (this=0x82303a8) at Connection.cc:267
#3 0x080a1b7e in Xaction::abortIo (this=0x8225230, m=(Size (Connection::*)(Connection * const)) 0x80a4530 <Connection::write()>, size=0xbffff818) at
Xaction.cc:190
#4 0x0806bc73 in CltXact::controlledMasterWrite (this=0x8225230, size=...) at CltXact.cc:235
#5 0x08085bc2 in SingleCxm::noteWriteReady (this=0x823c648) at SingleCxm.cc:95
#6 0x0814931a in FileScanUserReg::notifyWriteReady (this=0xb627c104, fd=7) at FileScanner.cc:159
#7 0x08149803 in FileScanner::scan (this=0x8226018, minP=fsupMin, timeout=0xbffff970) at FileScanner.cc:255
#8 0x08096944 in FileScanner::scan (this=0x8226018, tout=0xbffff970) at ../../src/xstd/FileScanner.h:157
#9 0x080911b7 in PolyApp::scan (this=0xbffffa34, toutp=0xbffff970) at PolyApp.cc:160
#10 0x08090e9b in PolyApp::step (this=0xbffffa34) at PolyApp.cc:125
#11 0x0804dca4 in PolyClt::step (this=0xbffffa34) at PolyClt.cc:230
#12 0x08096689 in PolyApp::run (this=0xbffffa34, argc=11, argv=0xbffffb84) at PolyApp.cc:1060
#13 0x0804dff8 in main (argc=11, argv=0xbffffb84) at PolyClt.cc:276
write io event handle -> after send request, add read event to epoll ctl manager:

(gdb) bt
bt
#0 Epoll::setFD (this=0x8226018, fd=7, dir=dirRead, u=0x823c648) at Epoll.cc:49
#1 0x080a340a in Connection::HalfPipe::start (this=0x82303dc, u=0x823c648) at Connection.cc:39
#2 0x08085ccc in SingleCxm::noteWriteReady (this=0x823c648) at SingleCxm.cc:112
#3 0x0814931a in FileScanUserReg::notifyWriteReady (this=0xb627c104, fd=7) at FileScanner.cc:159
#4 0x08149803 in FileScanner::scan (this=0x8226018, minP=fsupMin, timeout=0xbffff970) at FileScanner.cc:255
#5 0x08096944 in FileScanner::scan (this=0x8226018, tout=0xbffff970) at ../../src/xstd/FileScanner.h:157
#6 0x080911b7 in PolyApp::scan (this=0xbffffa34, toutp=0xbffff970) at PolyApp.cc:160
#7 0x08090e9b in PolyApp::step (this=0xbffffa34) at PolyApp.cc:125
#8 0x0804dca4 in PolyClt::step (this=0xbffffa34) at PolyClt.cc:230
#9 0x08096689 in PolyApp::run (this=0xbffffa34, argc=11, argv=0xbffffb84) at PolyApp.cc:1060
#10 0x0804dff8 in main (argc=11, argv=0xbffffb84) at PolyClt.cc:276
read io event handle -> after send request, read response:

(gdb) bt
bt
#0 Socket::read (this=0x8230434, buf=0x8701fd0, sz=...) at Socket.cc:160
#1 0x080a5553 in Connection::rawRead (this=0x82303a8, ioSz=...) at Connection.cc:526
#2 0x080a446f in Connection::read (this=0x82303a8) at Connection.cc:230
#3 0x080a1b7e in Xaction::abortIo (this=0x8225230, m=(Size (Connection::*)(Connection * const)) 0x80a42c2 <Connection::read()>, size=0x0) at Xaction.cc:190
#4 0x0806b5ae in CltXact::controlledMasterRead (this=0x8225230) at CltXact.cc:143
#5 0x08085af2 in SingleCxm::noteReadReady (this=0x823c648) at SingleCxm.cc:76
#6 0x08149261 in FileScanUserReg::notifyReadReady (this=0xb627c104, fd=7) at FileScanner.cc:144
#7 0x081497a4 in FileScanner::scan (this=0x8226018, minP=fsupAsap, timeout=0x81f1100 <_ZZN7PolyApp4scanEP4TimeE8zeroTout>) at FileScanner.cc:250
#8 0x080911d6 in PolyApp::scan (this=0xbffffa34, toutp=0xbffff970) at PolyApp.cc:160
#9 0x08090e9b in PolyApp::step (this=0xbffffa34) at PolyApp.cc:125
#10 0x0804dca4 in PolyClt::step (this=0xbffffa34) at PolyClt.cc:230
#11 0x08096689 in PolyApp::run (this=0xbffffa34, argc=11, argv=0xbffffb84) at PolyApp.cc:1060
#12 0x0804dff8 in main (argc=11, argv=0xbffffb84) at PolyClt.cc:276
read io event handle -> after read response, parse response header:

(gdb) bt
bt
#0 MsgHdr::parseContLen (this=0x8225434, buf=0x8702042 "612\r\nLast-Modified: Sat, 07 Sep 2013 13:06:24 GMT\r\nETag: \"522b24d0-264\"\r\nAccept-Ranges:
bytes\r\nAge: 0\r\nProxy-Connection: close\r\n\r\n<!DOCTYPE html>\n<html>\n<head>\n<title>Welcome to nginx!</title>\n<style>"...) at httpHdrs.cc:303
#1 0x080bcb16 in MsgHdr::parseFields (this=0x8225434) at httpHdrs.cc:182
#2 0x080bc93c in MsgHdr::parse (this=0x8225434, buf=0x8701fd0 "HTTP/1.1 200 OK\r\nServer: ATS/3.2.5\r\nDate: Wed, 06 Aug 2014 09:32:18 GMT\r\nContent-Type:
text/html\r\nContent-Length: 612\r\nLast-Modified: Sat, 07 Sep 2013 13:06:24 GMT\r\nETag: \"522b24d0-264\"\r\nAccept-Ranges"..., sz=...) at httpHdrs.cc:162
#3 0x0806db5e in HttpCltXact::getHeader (this=0x8225230) at HttpCltXact.cc:201
#4 0x0806da52 in HttpCltXact::controlledPostRead (this=0x8225230, needMore=@0xbffff88f: false) at HttpCltXact.cc:183
#5 0x08085b1e in SingleCxm::noteReadReady (this=0x823c648) at SingleCxm.cc:81
#6 0x08149261 in FileScanUserReg::notifyReadReady (this=0xb627c104, fd=7) at FileScanner.cc:144
#7 0x081497a4 in FileScanner::scan (this=0x8226018, minP=fsupAsap, timeout=0x81f1100 <_ZZN7PolyApp4scanEP4TimeE8zeroTout>) at FileScanner.cc:250
#8 0x080911d6 in PolyApp::scan (this=0xbffffa34, toutp=0xbffff970) at PolyApp.cc:160
#9 0x08090e9b in PolyApp::step (this=0xbffffa34) at PolyApp.cc:125
#10 0x0804dca4 in PolyClt::step (this=0xbffffa34) at PolyClt.cc:230
#11 0x08096689 in PolyApp::run (this=0xbffffa34, argc=11, argv=0xbffffb84) at PolyApp.cc:1060
#12 0x0804dff8 in main (argc=11, argv=0xbffffb84) at PolyClt.cc:276
read io event handle -> after read response, get response body complete:

(gdb) bt
bt
#0 SingleCxm::noteDone (this=0x823c648, x=0x8225230) at SingleCxm.cc:57
#1 0x0806d889 in HttpCltXact::finish (this=0x8225230, err=...) at HttpCltXact.cc:161
#2 0x0806e109 in HttpCltXact::getBody (this=0x8225230) at HttpCltXact.cc:286
#3 0x0806dacd in HttpCltXact::controlledPostRead (this=0x8225230, needMore=@0xbffff88f: false) at HttpCltXact.cc:191
#4 0x08085b1e in SingleCxm::noteReadReady (this=0x823c648) at SingleCxm.cc:81
#5 0x08149261 in FileScanUserReg::notifyReadReady (this=0xb627c104, fd=7) at FileScanner.cc:144
#6 0x081497a4 in FileScanner::scan (this=0x8226018, minP=fsupAsap, timeout=0x81f1100 <_ZZN7PolyApp4scanEP4TimeE8zeroTout>) at FileScanner.cc:250
#7 0x080911d6 in PolyApp::scan (this=0xbffffa34, toutp=0xbffff970) at PolyApp.cc:160
#8 0x08090e9b in PolyApp::step (this=0xbffffa34) at PolyApp.cc:125
#9 0x0804dca4 in PolyClt::step (this=0xbffffa34) at PolyClt.cc:230
#10 0x08096689 in PolyApp::run (this=0xbffffa34, argc=11, argv=0xbffffb84) at PolyApp.cc:1060
#11 0x0804dff8 in main (argc=11, argv=0xbffffb84) at PolyClt.cc:276
read io event handle -> transaction over and check if retry request:

(gdb) bt
bt
#0 Client::noteXactDone (this=0x82319f8, x=0x8225230) at Client.cc:274
#1 0x0806b53b in CltXact::finish (this=0x8225230, err=...) at CltXact.cc:136
#2 0x0806d9fd in HttpCltXact::finish (this=0x8225230, err=...) at HttpCltXact.cc:177
#3 0x0806e109 in HttpCltXact::getBody (this=0x8225230) at HttpCltXact.cc:286
#4 0x0806dacd in HttpCltXact::controlledPostRead (this=0x8225230, needMore=@0xbffff88f: false) at HttpCltXact.cc:191
#5 0x08085b1e in SingleCxm::noteReadReady (this=0x823c648) at SingleCxm.cc:81
#6 0x08149261 in FileScanUserReg::notifyReadReady (this=0xb627c104, fd=7) at FileScanner.cc:144
#7 0x081497a4 in FileScanner::scan (this=0x8226018, minP=fsupAsap, timeout=0x81f1100 <_ZZN7PolyApp4scanEP4TimeE8zeroTout>) at FileScanner.cc:250
#8 0x080911d6 in PolyApp::scan (this=0xbffffa34, toutp=0xbffff970) at PolyApp.cc:160
#9 0x08090e9b in PolyApp::step (this=0xbffffa34) at PolyApp.cc:125
#10 0x0804dca4 in PolyClt::step (this=0xbffffa34) at PolyClt.cc:230
#11 0x08096689 in PolyApp::run (this=0xbffffa34, argc=11, argv=0xbffffb84) at PolyApp.cc:1060
#12 0x0804dff8 in main (argc=11, argv=0xbffffb84) at PolyClt.cc:276
pgl配置文件以及运行结果:
root@ubuntu:/usr/local/polygraph-4.3.2-M/bin# cat proxy_cfg.pg 
/*
 * A very simple "Hello, World!" workload
 */

// experiment duration
time ExpDur = 4hour;

ObjLifeCycle olcStatic = {
        length = const(2year);          // two year cycle
        variance = 0%;                  // no variance
        with_lmt = 100%;                // all responses have LMT
        expires = [nmt + const(0sec)];  // everything expires when modified
};

Content cntHTTPKB_html_1 = {
        kind = "HTTP_HTML"; // just a label
        mime = { type =  undef(); prefixes = ["htm_pgclient/"]; extensions = [ ".html" ]; };
        size = exp(20KB);
        obj_life_cycle = olcStatic;
        cachable = 50%;
};

Content cntHTTPKB_html_2 = {
        kind = "HTTP_HTML"; // just a label
        mime = { type =  undef(); prefixes = ["htm_pgclient/"]; extensions = [ ".html" ]; };
        size = exp(20KB);
        obj_life_cycle = olcStatic;
        cachable = 50%;
};
Content cntHTTPKB_html_3 = {
        kind = "HTTP_HTML"; // just a label
        mime = { type =  undef(); prefixes = ["htm_pgclient/"]; extensions = [ ".html" ]; };
        size = exp(20KB);
        obj_life_cycle = olcStatic;
        cachable = 50%;
};
// 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      = [ cntHTTPKB_html_1: 30%, cntHTTPKB_html_2: 20%, cntHTTPKB_html_3];
        direct_access = contents;

        addresses = ['127.0.0.1' ]; // where to create these server agents
};

// a primitive robot
Robot R = {
        kind = "R101";
        pop_model = { pop_distr = popUnif(); };
        recurrence = 0%; 
        interests = [ "public": 74%, "private" ];
        req_rate = 1/sec;

        origins = S.addresses;      // where the origin servers are
        addresses = ['127.0.0.1' ** 2 ]; // where these robot agents will be created
};

/* phases (note that load is kept at constant level) */

Phase phWarm = {
        name = "warm";
        goal.duration = 10% * ExpDur;
        load_factor_beg = 1;         // load starts high right away
        log_stats = false;
};

Phase phMeas = {
        name = "meas";
        goal.duration = ExpDur - phWarm.goal.duration; // the rest of the run
};

Phase phXact = {
        name = "xact";
        goal.xactions = 1;
};

// build schedule using some well-known phases and phases defined above
//schedule(phWait, phWarm, phMeas, phCool);
//schedule(phMeas);
schedule(phXact);

// commit to using these servers and robots
use(S, R);
root@ubuntu:/usr/local/polygraph-4.3.2-M/bin# ./polygraph-client --cfg_dirs ../share/polygraph/workloads/include/ --config ./proxy_cfg.pg --verb_lvl 10 --log a.log --dump hdrs --proxy 127.0.0.1:8080
000.01| dynamic modules loaded: 0
000.01| Command: ./polygraph-client --cfg_dirs ../share/polygraph/workloads/include/ --config ./proxy_cfg.pg --verb_lvl 10 --log a.log --dump hdrs --proxy 127.0.0.1:8080
000.01| Configuration:
        version:            4.3.2
        host_type:          i686-pc-linux-gnu
        verb_lvl:           10
        dump:               req,-hdrrep,-hdrerr,embed_stats-hdr
        dump_size:          1.000KB
        notify:             <none>
        doorman_listen_at:  <none>
        doorman_send_to:    <none>
        label:              [none]
        fd_limit:           3962
        config:             ./proxy_cfg.pg
        cfg_dirs:           ../share/polygraph/workloads/include/
        console:            -
        log:                a.log
        log_buf_size:       64.000KB
        store_working_set:  [none]
        load_working_set:   [none]
        sample_log:         a.log
        sample_log_buf_size:64.000KB
        accept_foreign_msgs:off
        stats_cycle:        5.00sec
        file_scan:          epoll
        priority_sched:     5
        fake_hosts:         
        delete_old_addrs:   yes
        idle_tout:          <none>
        local_rng_seed:     1
        global_rng_seed:    1
        unique_world:       on
        hushed_error_tout:  1.00min
        proxy:              127.0.0.1:8080
        ports:              <none>
        loadable_modules:   
        icp_tout:           2.00sec
        ign_false_hits:     on
        ign_bad_cont_tags:  off
        prn_false_misses:   off
000.01| Server content distributions:
        Server S101:
                content   planned%    likely%     error% mean_sz_bytes
              HTTP_HTML      30.00      33.33      11.11   20502.44
              HTTP_HTML      20.00      33.33      66.67   20409.63
              HTTP_HTML      50.00      33.33     -33.33   20089.25
        expected average server-side cachability: 50.00%
        expected average server-side object size: 20333.77Bytes

000.01| Phases:
     phase  pop_beg  pop_end load_beg load_end  rec_beg  rec_end smsg_beg smsg_end     goal      flags
      xact     1.00     1.00     1.00     1.00     1.00     1.00     1.00     1.00     1

000.01| StatsSamples:
        static stats samples:   0
        dynamic stats samples:  0

000.01| FDs: 4096 out of 4096 FDs can be used; safeguard limit: 3962
000.01| resource usage: 
        CPU Usage: 432msec sys + 668msec user = 1.10sec
        Maximum Resident Size: 62.734MB
        Page faults with physical i/o: 0

000.01| group-id: 1d813d43.047236c4:00000002 pid: 14020
000.01| current time: 1407354770.301599 or Wed, 06 Aug 2014 19:52:50 GMT
000.01| registered client-side session watches: 0
000.01| registered client-side data filters: 0
000.01| fyi: PGL configuration stored (1421bytes)
000.01| fyi: all 2 Robot IP address(es) lack interface name or netmask
000.01| found 2 Robot IP address(es) total (0 unique address(es) with interface name and netmask).
000.01| fyi: no bench selected with use()
000.01| ./proxy_cfg.pg:49: private Robot URLs are currently not supported, private interest is treated as additional public interest
000.01| created 2 agents total
000.01| Robot R101 [1 / 1d813d43.047236c4:00000006] at 127.0.0.1 via 127.0.0.1:8080 (http and ftp)
000.01| Robot R101 [2 / 1d813d43.047236c4:0000000a] at 127.0.0.1 via 127.0.0.1:8080 (http and ftp)
1407354770.305467 event: log_state x 2
000.01| fyi: current state (1) stored
000.01| fyi: max local population size: 2 robots
1407354770.331387 event: agent_beg x 2
000.01| fyi: current lock level for 'warmup' increased to 1
000.01| started a warmup plan for Robot 'R101' with 1 cold servers, out of 1 already visible
1407354770.331387 event: session_beg x 2
1407354770.331387 event: agent_beg x 2
1407354770.331387 event: session_beg x 2
000.01| fyi: reached max local population size: 2 robots
1407354770.960052 event: conn_open x 2
1407354770.960052 event: xact_beg x 2
1407354770.961080# obj: http://127.0.0.1/htm_pgclient/w1d813d43.047236c4:00000008/t03/_00000001.html flags: basic,GET, size: 0/-1 xact: 1d813d43.047236c4:0000000c
GET http://127.0.0.1/htm_pgclient/w1d813d43.047236c4:00000008/t03/_00000001.html HTTP/1.1
Accept: */*
Host: 127.0.0.1
X-Xact: 1d813d43.047236c4:00000002 1d813d43.047236c4:0000000c 0
X-Loc-World: 1d813d43.047236c4:00000008 -1/1 0
X-Rem-World: 1d813d43.047236c4:00000008 -1/1 0
X-Target: 127.0.0.1
X-Abort: 1412400744 2082554117
X-Phase-Sync-Pos: 0
Proxy-Connection: close

1407354770.961080 event: conn_est x 2
000.03| fyi: received first foreign response to Polygraph-specific URL:
1407354771.137689# obj: http://127.0.0.1/htm_pgclient/w1d813d43.047236c4:00000008/t03/_00000001.html flags: foreignSrc,basic,GET, size: 0/856 xact: 1d813d43.047236c4:0000000c
HTTP/1.1 200 OK
Server: ATS/3.2.5
Date: Wed, 06 Aug 2014 19:52:51 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Sat, 07 Sep 2013 13:06:24 GMT
ETag: "522b24d0-264"
Accept-Ranges: bytes
Age: 0
Proxy-Connection: close

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

000.03| HttpCltXact.cc:847: error: 1/1 (c1) foreign HTTP request or response
1407354771.137689 event: error x 0
1407354771.137689# obj: http://127.0.0.1/htm_pgclient/w1d813d43.047236c4:00000008/t03/_00000001.html flags: foreignSrc,basic,GET, size: 0/856 xact: 1d813d43.047236c4:0000000c
HTTP/1.1 200 OK
Server: ATS/3.2.5
Date: Wed, 06 Aug 2014 19:52:51 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Sat, 07 Sep 2013 13:06:24 GMT
ETag: "522b24d0-264"
Accept-Ranges: bytes
Age: 0
Proxy-Connection: close

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

1407354771.137689# obj: http://127.0.0.1/htm_pgclient/w1d813d43.047236c4:00000008/t03/_00000001.html flags: foreignSrc,basic,GET,chb, size: 0/856 xact: 1d813d43.047236c4:0000000c
HTTP/1.1 200 OK
Server: ATS/3.2.5
Date: Wed, 06 Aug 2014 19:52:51 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Sat, 07 Sep 2013 13:06:24 GMT
ETag: "522b24d0-264"
Accept-Ranges: bytes
Age: 0
Proxy-Connection: close

1407354771.137689 event: xact_end x 2
000.03| locked (warmup) phase 'xact' reached local positive goal
1407354771.137689 event: conn_close x 2
1407354771.395061 event: conn_open x 2
1407354771.395061 event: xact_beg x 2
1407354771.395490# obj: http://127.0.0.1/htm_pgclient/w1d813d43.047236c4:00000008/t03/_00000002.html flags: basic,GET, size: 0/-1 xact: 1d813d43.047236c4:0000000e
GET http://127.0.0.1/htm_pgclient/w1d813d43.047236c4:00000008/t03/_00000002.html HTTP/1.1
Accept: */*
Host: 127.0.0.1
X-Xact: 1d813d43.047236c4:00000002 1d813d43.047236c4:0000000e 0
X-Loc-World: 1d813d43.047236c4:00000008 -1/2 1
X-Rem-World: 1d813d43.047236c4:00000008 -1/2 1
X-Target: 127.0.0.1
X-Abort: 1798565613 512442519
X-Phase-Sync-Pos: 0
Proxy-Connection: close

1407354771.395490 event: conn_est x 2
000.03| HttpCltXact.cc:847: error: 2/2 (c1) foreign HTTP request or response
1407354771.441268 event: error x 0
1407354771.441268# obj: http://127.0.0.1/htm_pgclient/w1d813d43.047236c4:00000008/t03/_00000002.html flags: foreignSrc,basic,GET, size: 0/856 xact: 1d813d43.047236c4:0000000e
HTTP/1.1 200 OK
Server: ATS/3.2.5
Date: Wed, 06 Aug 2014 19:52:51 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Sat, 07 Sep 2013 13:06:24 GMT
ETag: "522b24d0-264"
Accept-Ranges: bytes
Age: 0
Proxy-Connection: close

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

1407354771.441268# obj: http://127.0.0.1/htm_pgclient/w1d813d43.047236c4:00000008/t03/_00000002.html flags: foreignSrc,basic,GET,chb, size: 0/856 xact: 1d813d43.047236c4:0000000e
HTTP/1.1 200 OK
Server: ATS/3.2.5
Date: Wed, 06 Aug 2014 19:52:51 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Sat, 07 Sep 2013 13:06:24 GMT
ETag: "522b24d0-264"
Accept-Ranges: bytes
Age: 0
Proxy-Connection: close

1407354771.441268 event: xact_end x 2
1407354771.441268 event: conn_close x 2
000.05| stopped warmup plan for Robot 'R101' with 0 cold servers, out of 1 globally visible
000.05| fyi: current lock level for 'warmup' decreased to 0
000.05| fyi: local phase `xact' reached synchronization point
000.05| p-xact      2   0.90    112   0.00   0
1407354772.554103 event: shutdown x 1
000.05| fyi: server scan completed with all local robots ready to hit all 1 visible servers
1407354772.554103 event: conn_open x 2
1407354772.554103 event: xact_beg x 2
000.05| resource usage: 
        CPU Usage: 676msec sys + 700msec user = 1.38sec
        Maximum Resident Size: 81.875MB
        Page faults with physical i/o: 0

1407354772.554103 event: log_state x 2
000.05| fyi: current state (2) stored
000.05| got 2 xactions and 0 errors
000.05| shutdown reason: all 1 phases met their goals
root@ubuntu:/usr/local/polygraph-4.3.2-M/bin#
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: