Server Challenge 08

From CSLabsWiki
Revision as of 08:15, 10 March 2008 by Torreyji (talk | contribs) (added ab results for Justin's server)


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.


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

The Entries


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).
2> httpd:start(9999). % Replace with whatever port you want
3> httpd:stop().
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.


Using ab with -c 70, we got an average response time of <1ms.


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.


Using ab with -c 10, we got an average response time of 853ms with a maximum time of 22305ms.


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.


Unable to benchmark due to lack on HTTP implementation.


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

ruby httpd.rb 9999 # Port optional


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.


Justin Bennet wrote a server in Java.


Server Software:
Server Hostname:
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)


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