Difference between revisions of "Server Challenge 08"

From CSLabsWiki
Jump to: navigation, search
(Benchmark: New benchmark now that vfork() is being used)
m (C: Small update)
Line 197: Line 197:
  
 
<code lang="bash">
 
<code lang="bash">
./my_web 9999 . # Pick a port here and a top level directory
+
./my_web 9999 # Pick a port here
 
</code>
 
</code>
  

Revision as of 09:56, 24 March 2008

Summary

The server challenge was a fun little experiment to show people how much thought and effort is required to make a HTTP server. The assignment was to take some time and program, in any language, a very simple multi-threaded HTTP 1.0 server that can at-least handle GET requests. It was open to anyone and was just for fun as an educational experience.

Rules

  • No using a languages built-in HTTPd that some languages have

The Entries

Erlang

Jacob Torrey wrote an Erlang server. To run it start up Erlang and type the following:

Erlang (BEAM) emulator version 5.6 [source] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.6  (abort with ^G)
1> c(httpd).
{ok,httpd}
2> httpd:start(9999). % Replace with whatever port you want
http_server
3> httpd:stop().
ok
Quitting
4> q().

The server supports the following features:

  • MIME type lookup
  • CGI and PHP (But doesn't pass GET variables)

The code can be downloaded here.

Benchmark

Command: ab -c 10 -n 1000 

Server Software:        
Server Hostname:        neptune.price (700Mhz PII, 512 MB RAM, 20 GB HDD, 4800RPM)
Server Port:            9999

Document Path:          /test.html
Document Length:        92 bytes

Concurrency Level:      10
Time taken for tests:   0.875310 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      157000 bytes
HTML transferred:       92000 bytes
Requests per second:    1142.45 [#/sec] (mean)
Time per request:       8.753 [ms] (mean)
Time per request:       0.875 [ms] (mean, across all concurrent requests)
Transfer rate:          174.80 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.5      0      11
Processing:     2    5  20.6      3     216
Waiting:        1    4  20.6      2     215
Total:          2    5  20.6      3     216

Percentage of the requests served within a certain time (ms)
  50%      3
  66%      3
  75%      3
  80%      4
  90%      4
  95%      4
  98%     14
  99%     71
 100%    216 (longest request)

Perl

Jacob Torrey also wrote a perl server. To run it type the following at the command-line:

./httpd 9999 # Pick a port here

This code was meant to be as short as possible, and thus has a very limited functionality. You can download the source code here.

Benchmark

Command: ab -c 10 -n 1000 

Server Software:        
Server Hostname:        neptune.price (700Mhz PII, 512 MB RAM, 20 GB HDD 4800RPM)
Server Port:            9999

Document Path:          /test.html
Document Length:        92 bytes

Concurrency Level:      10
Time taken for tests:   82.304981 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      156000 bytes
HTML transferred:       92000 bytes
Requests per second:    12.15 [#/sec] (mean)
Time per request:       823.050 [ms] (mean)
Time per request:       82.305 [ms] (mean, across all concurrent requests)
Transfer rate:          1.85 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0  383 1653.5      0   20999
Processing:    23  417 563.5    310    6705
Waiting:       22  406 559.3    304    6705
Total:         23  801 1758.9    327   21578

Percentage of the requests served within a certain time (ms)
  50%    327
  66%    434
  75%    515
  80%    601
  90%   1848
  95%   3455
  98%   5505
  99%   9263
 100%  21578 (longest request)

PHP

Jacob Torrey also started a PHP server, but didn't implement the actual HTTP specs, just a socket and threading model. If interested, the code can be downloaded here.

Benchmark

Unable to benchmark due to lack on HTTP implementation.

Ruby

Chris Peterman wrote a server in Ruby. To run it type the following at the command-line:

ruby httpd.rb 9999 # Port optional

Benchmark

When running (an early version), it didn't work, nor did it respond to CTRL-C. I'm sure it fell in between the perl server and the Java server.

Java

Justin Bennett wrote a server in Java.

The source can be downloaded here. Note that this code was written in the Eclipse development environment and tested on a machine running Windows. In order to use this code, the configuration file included in the archive must be modified appropriately and placed in the same path as the java compiler. Defaults will be set in the absence of the file but these may not be suitable for every situation.

Benchmark

Command: ab -c 10 -n 1000 

Server Software:
Server Hostname:        blackbox.woodstock.clarkson.edu (2.6Ghz Athlon 64 X2, 2GB RAM, 250GB 7200RPM)
Server Port:            8080

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   6.761950 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      24000 bytes
HTML transferred:       0 bytes
Requests per second:    147.89 [#/sec] (mean)
Time per request:       67.620 [ms] (mean)
Time per request:       6.762 [ms] (mean, across all concurrent requests)
Transfer rate:          3.40 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   37 326.5      1    3004
Processing:     0    5  25.7      2     231
Waiting:        0    5  25.7      1     230
Total:          0   42 327.3      3    3009

Percentage of the requests served within a certain time (ms)
  50%      3
  66%      4
  75%      5
  80%      6
  90%      9
  95%     15
  98%    225
  99%   2997
 100%   3009 (longest request)

C

Ryan Lewis wrote a server in C, but it was a late entry and therefore did not get to compete. To run the server, type the following on a command-line:

./my_web 9999 # Pick a port here

Note: This is a very bare-bones web server. You can download the source code here.

Benchmark

Command: ab -c 10 -n 1000

Server Software:        
Server Hostname:        localhost (1.7GHz Pentium M, 1GB RAM, 60GB 7200RPM)
Server Port:            8080

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   0.282626 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      0 bytes
HTML transferred:       0 bytes
Requests per second:    3538.24 [#/sec] (mean)
Time per request:       2.826 [ms] (mean)
Time per request:       0.283 [ms] (mean, across all concurrent requests)
Transfer rate:          0.00 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.9      1       8
Processing:     0    1   0.9      1       8
Waiting:        0    0   0.0      0       0
Total:          1    2   1.3      2       9

Percentage of the requests served within a certain time (ms)
  50%      2
  66%      2
  75%      2
  80%      2
  90%      3
  95%      3
  98%      9
  99%      9
 100%      9 (longest request)

Results

The prize (a book on networking) was awarded to Jacob for the only operational servers during the event.