Contatct: Li Yuan
Home Overview Source Code Installation Sample Scripts

 

Overview

Implementation

This User Model simulator extends Webcache module in NS2.

    Overview of Webcache

    There are three major classes related to web cache, as it is in the real world: client (browser or user), server, and cache. They are Http/Client, Http/Server, Http/Cache, derived from the same base class Http (Otcl class, HttpApp in C++). Http (derived from Process) is not real Appication in NS2. It transmits real data and that's provided by TcpApp instead of any Agent.

    TcpApp is the Tcp agent wrapper, currently it supports symmetric TCP agent only (FullTcp). TcpApp object is derived from Application in NS2, it contains a pointer to a transport agent.


    Our Extension

    Our aim is to let 'client' have some user behavior, such like abort currently on-going download, 'click' another page after abort, having some think time, sleep time (session interval), etc. We extend Http/Client and Http/Server to Http/Client/AbortClient and Http/Server/NewServer. Since we are not interested in Cache object, we disabled this class in our model.

    Our extended model can use measured data from real trace as web surffing parameters. These parameters include: FTO (frustration timeout), think time (time between two dowloads), sleep time (time between two sessions), webpage size. It can also use RandomVariable object in NS2 to generate these data.

    How User Model Works?

    Our model works like real HTTP by implementing request/response exchanging between clients and servers. Here we consider every request as a request for a download.

    1. Client sends request to server (Http/Client/AbortClient send-request)
    2. Each request specify which page it wants. The request size is 43Bytes by default.

      Client will set a FTO timer, when the timer timeouts before download competes, it will decide whether abort or not.

    3. Server gets request (Http/Server/NewServer get-request)
    4. When server gets this request, it will check the requested page size, then deliver these bytes to client.

    5. Client gets response (Http/Client/AbortClient get-response-GET)
    6. After client gets all the bytes it requested, it will arrange for next download.

       

Class Overview

Http/Client/AbortClient

Here is the table of major memeber functions. The meaning of memeber variables are explained in the source code files.

start-connection
There are three ways to start-connection:
1) first time connected to server
2) abort =>retry
3) sleep => new session
connect
connecting the agents, TcpApps
start-session
client starts sending request
disconnect
client abort from server, called by 'abort'
stop-session
stop sending further requests and clear pending requests if any
abort?
decide abort or not, will call 'abort' if decides to abort
abort
will call 'disconnect' and 'reconnect?'
reconnect?
called by 'abort', will decide whether retry or not, if not 'goto-sleep'
goto-sleep
called either by 'reconnect?' or 'next-download?', will call either 'goto-sleep1' or 'goto-sleep2'
goto-sleep1
after sleep, will start a new session
goto-sleep2
will not start a new session ("open model")
new-session
clients starts a new session, called after 'sleep'
send-request
client starts downloading
get-response-GET
called when requested download finished
next-download?
called by "get-response-GET", starting next download depends on p_next.
gen-request
generate next request after completing previous download
gen-resume-request
generate resume request after aborting previous download
set-retryinterval-generator
configure the interval between abort and retry

 

Http/Server/NewServer

We will use most of the functions of Http/Server except below two.

disconnect
server disconnects from client
get-request
handling the request from client