Server Design Alternatives



 

 

 

Ø   The Client

Ø   Iterative Server

Ø   Forking on Demand

Ø   Threading on Demand

 

 

 

 

 

 


Ø   The Client

 

ü    client.c

 


Example Use:

 
% client something 9999  5   500   4000


means:

      contact a server running at something port 9999 and

creates 5 children,  each makes 500 TCP connections and

in each connection sends 5 bytes "4000\n"

and gets 4000 bytes from server.

 

 

 

 

 


Ø   Iterative Server:

 

ü   serv00.c


(it uses web_child.c & pr_cpu_time.c)

To test this server, we run only one client as:

 

something % cd /home/cs779/stevens3rd.book/unpv13e/server

something % serv00   9999
somethingmore % client  something  9999 1  5000 4000

 I.e., one client makes 5,000 TCP connections.

When client is done, interrupt the server and it will print:

^C

user time = 0.134386, sys time = 1.58777

 

 

 

 


Ø   Forking on demand: 

 

ü   serv01.c

 

    (it uses sig_chld_waitpid.c )

Example Use:
something % serv01   9999
somethingmore  % client  something  9999 5 500 4000
somethingextra  % client  something  9999 5 500 4000

^C

user time = 4.19626, sys time = 19.5181

 

 

 

 

 

 


Ø   Threading on demand

 

ü   serv06.c

Example Use:

something % serv06   9999
somethingmore  % client something 9999 5 500 4000
somethingextra  % client  something 9999 5 500 4000

 

^C

user time = 0.851565, sys time = 3.22727