[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with webcache classes?



There is a restriction on a web client that is there can be only one
client on one _node_. 

The reason is purely simplicity and clarity. When one uses
the webcache classes, it is assumed that the interest is in the HTTP
and other application-level protocols. Putting one client per node helps
clean up the trace file and makes it easier to understand the protocol.
However, if there are interests in supporting multiple clients per node,
we will consider support that. 

If one is interested in generating web traffic, perhaps Kedar's http code
or Polly's web traffic code (webcache/webtraf.cc) is more relevant.

- Haobo

On Mon, 29 Nov 1999, Tom Pavel wrote:

> Chapter 27 of the NS manual describes the "webcache" classes.
> Although there are other Http implementations in the examples
> directories and so forth, I thought I would try to use the webcache
> classes for a simple Http simulation ("simple" meaning that I'm not
> doing any caching).
> 
> In the sample code below, everything runs fine when NUMCLIENTS is set
> to 1, but trouble begins with NUMCLIENTS set to 2.  Things run ok
> until 28.7 seconds, at which point the page going to $client(1) gets
> "lost" and the simulation pretty much grinds to a halt after that.
> 
>     set ns [new Simulator]
> 
>     set n0 [$ns node]
>     set n1 [$ns node]
> 
>     $ns duplex-link $n0 $n1 10Mb 20ms DropTail
> 
>     # Create page pool
>     set pgp [new PagePool/Math]
>     set rv1 [new RandomVariable/Pareto]
>     $rv1 set avg_ 8000
>     $pgp ranvar-size $rv1
>     set rv2 [new RandomVariable/Exponential]
>     $rv2 set avg_ 5
>     $pgp ranvar-age $rv2
> 
>     set server [new Http/Server $ns $n1]
>     $server set-page-generator $pgp
> 
>     set NUMCLIENTS 2
>     set rv3 [new RandomVariable/Exponential]
>     $rv3 set avg_ 1
>     for {set i 0} {$i < $NUMCLIENTS} {incr i 1} {
> 	set client($i) [new Http/Client $ns $n0]
> 	$client($i) set-interval-generator $rv3
> 	$client($i) set-page-generator $pgp
>     }
> 
>     proc start {} {
> 	global server client NUMCLIENTS
> 	for {set i 0} {$i < $NUMCLIENTS} {incr i 1} {
> 	    $client($i) connect $server
> 	    $client($i) start-session $server $server
> 	}
>     }
> 
>     $ns at 1 "start"
>     $ns at 100 "finish"
> 
> 
> It turns out that this happens because I put both Http/Client objects
> on the same node.  The real problem here is that HttpApp::add_cnc()
> and lookup_cnc() use the id() method of Http/Client to identify the
> TcpApp connection, but the init method of Http (in http-agent.tcl)
> initializes id_ to [$node_ id].  Hence both clients have the same id,
> and only one TcpApp connection ever gets used.
> 
> So, my question is how best to fix this?  I see that the Http class
> has a getfid() method that serves to draw a unique integer for each
> Http/Client.  Perhaps this fid_ could be reused for the id_, or at
> least the same pattern could be used to draw a unique id_ for each Http
> instance.  Is there anything special about id_ that should be tied to
> its node?  (I assume there is no reason, in principle, why I cannot
> have multiple Http clients on a single node...)
> 
> 
> I should mention that this is all with ns-2.1b5.  I have not checked
> to see if this bug is fixed in the current snapshot (but a quick check
> of the CVSweb pages indicated that id handling is unchanged).
> 
> 
> Thanks for any pointers,
> 
> Tom Pavel
> [email protected] 
> 
> 
>