12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}int id_; // object IDWebTrafSession* sess_; // the session th<strong>at</strong> requested this pageint nObj_; // number of object in this pageint curObj_ ; // number of object th<strong>at</strong> have been sentNode* dst_; // server th<strong>at</strong> this page has been requested fromFollowing is a list of rel<strong>at</strong>ed OTcl methods to the WebTraf class.set-num-session 〈number-of-session〉set-num-server 〈number-of-server〉set-num-client 〈number-of-client〉set-interPageOption 〈option〉doneObj 〈webpage〉set-server 〈id〉 〈node〉set-client 〈id〉 〈node〉recycle 〈tcp〉 〈sink〉cre<strong>at</strong>e-session 〈session-index〉 〈pages-per-sess〉〈launch-time〉 〈inter-page-rv〉 〈page-size-rv〉〈inter-obj-rv〉 〈obj-size-rv〉set the total number of sessio<strong>ns</strong> in the WebTraf pool.set the total number of servers.set the total number clients.<strong>The</strong>re are two ways to interpret inter-page time: One is the time betweenthe start of two co<strong>ns</strong>ecutive page downloads by the same user,<strong>and</strong> the other is the time between the end of previous page download<strong>and</strong> the start of the following page by the same user. $option can beset to either 0 or 1 (default is 1). When $option is set to 1, the secondinterpret<strong>at</strong>ion is used for "inter-page" time. <strong>The</strong> first interpr<strong>at</strong><strong>at</strong>ion isadopted when $option is set to 0. Note the resulted traffic volume usingthe first interpret<strong>at</strong>ion is much higher than the second interpret<strong>at</strong>ion.all the objects in $webpage have been sent.set $node as server $id.set $node as client $id.Recycle a TCP source/sink pair.Cre<strong>at</strong>e a Web session. $session-index is the sesson index. $pages-persessis the total number of pages per session. $launch-time is sessio<strong>ns</strong>tarting time. $inter-page-rv is the r<strong>and</strong>om variable th<strong>at</strong> gener<strong>at</strong>es pageinter-arrival time. $page-size-rv is the r<strong>and</strong>om variable th<strong>at</strong> gener<strong>at</strong>esnumber of objects per page. $inter-obj-rv is the r<strong>and</strong>om variable th<strong>at</strong>gener<strong>at</strong>es object inter-arrival time. $obj-size-rv is the r<strong>and</strong>om variableth<strong>at</strong> gener<strong>at</strong>es object size.<strong>The</strong> example script is available <strong>at</strong> <strong>ns</strong>/tcl/ex/web-traffic.tcl (also see <strong>ns</strong>/tcl/ex/large-scale-web-traffic.tcl for use of a large-scaleweb traffic simul<strong>at</strong>ion)39.5 Web clientClass Http/Client models behavior of a simple web browser. It gener<strong>at</strong>es a sequence of page requests, where request interval<strong>and</strong> page IDs are r<strong>and</strong>omized. It’s a pure OTcl class inherited from Http. Next we’ll walk through its functionalities <strong>and</strong>usage.Cre<strong>at</strong>ing a client First of all, we cre<strong>at</strong>e a client <strong>and</strong> connect it to a cache <strong>and</strong> a web server. Currently a client is onlyallowed to connect to a single cache, but it’s allowed to connect to multiple servers. Note th<strong>at</strong> this has to be called AFTERthe simul<strong>at</strong>ion starts (i.e., after $<strong>ns</strong> run is called). This remai<strong>ns</strong> true for all of the following methods <strong>and</strong> code examples ofHttp <strong>and</strong> its derived classes, unless explicitly said.352

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!