We will benchmark Apache 2 (2.2.22-1ubuntu1.11) and Ada Web Server (gpl-2015 v3.2.0-130-ge783771), on an up to date Ubuntu 12.04 LTS DELL Inspiron 5521 laptop with CPU at 778 Mhz (Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz, 2 cores, 4 threads)



1. Benckmark context



  • we will send 10_000 requests using 100 concurrent connections using 4 threads
  • each request will retrieve a simple 100 bytes file (100.html)
  • default installation and configuration for each web server
  • reuse mode for web clients (sudo sysctl -w net.ipv4.tcp_tw_reuse=1)
  • ulimit set for web clients (sudo sh -c ulimit -HSn 200000)
  • weighttp used as the benchmark agent


2. Apache 2



Simply create the 100 bytes file /var/www/100.html 

Running the bench would give
$ weighttp -n 10000 -c 100 -t 4 -k "http://127.0.0.1/100.html"
weighttp 0.4 - a lightweight and simple webserver benchmarking tool

starting benchmark...
spawning thread #1: 25 concurrent requests, 2500 total requests
spawning thread #2: 25 concurrent requests, 2500 total requests
spawning thread #3: 25 concurrent requests, 2500 total requests
spawning thread #4: 25 concurrent requests, 2500 total requests
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 0 sec, 480 millisec and 499 microsec, 20811 req/s, 8429 kbyte/s
requests: 10000 total, 10000 started, 10000 done, 10000 succeeded, 0 failed, 0 errored
status codes: 10000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 4147341 bytes total, 3137341 bytes http, 1010000 bytes data


3. Ada Web Server



Create an Ada Web Server application with a service callback as follow;

  function Service (Request : in AWS.Status.Data) return AWS.Response.Data
is
Context : AWS.Response.Data;
begin
Context := AWS.Response.File (Content_Type => "text/html",
Filename => "100.html");
return Context;
end Service;
We will tune the Ada Web Server concerning 3 points;

3.1. Hard coded file name



As you can see, the file to retrieve is hard coded.

3.2. Create 100.html.gz file version



We will also create a 100.html.gz for the Ada Web Server to use the GZ file.
gzip -c 100.html > 100.html.gz

3.3. Configure the Ada Web Server application



The Ada Web Server configuration file will also contains the following settings
Reuse_Address TRUE
Session False
Max_Connection 4
Running the bench would give
$ weighttp -n 10000 -c 100 -t 4 -k "http://127.0.0.1:8686/100.html"
weighttp 0.4 - a lightweight and simple webserver benchmarking tool

starting benchmark...
spawning thread #1: 25 concurrent requests, 2500 total requests
spawning thread #2: 25 concurrent requests, 2500 total requests
spawning thread #3: 25 concurrent requests, 2500 total requests
spawning thread #4: 25 concurrent requests, 2500 total requests
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done

finished in 3 sec, 13 millisec and 604 microsec, 3318 req/s, 1002 kbyte/s
requests: 10000 total, 10000 started, 10000 done, 9995 succeeded, 5 failed, 0 errored
status codes: 9995 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 3093830 bytes total, 2084335 bytes http, 1009495 bytes data



4. Conclusion



In this context, that is more suitable for the Ada Web Server application, Apache 2 handle 20_811 requests per seconds while Ada Web Server application handle 3_318 requests per seconds, Apache 2 is about 6 times faster than the Ada Web Server application.
While Apache 2 is still 2.4 times faster than AdaLabs enhanced version of Ada Web Server using this benchmark, there is still a lot of enhancements to be achieved in Ada Web Server

Weighttp - git clone https://github.com/lighttpd/weighttp.git

Ada Web Server - http://libre.adacore.com/tools/aws/

Apache - https://httpd.apache.org/