-
apt-get update
-
apt-get install apache2-utils
-
apt-get install nginx
-
service nginx start
-
ab -c 100 -n 10000 http://localhost/httptest/wikipedia_russia.html (1200 rps with my machine)
-
service nginx stopped
-
sudo python3 server.py (600 rps with my machine)
Implement a Web server in the programming language of your choice. Libraries for helping manage TCP socket connections may be used (libevent allowed). Libraries that implement any part of HTTP or multiprocessing model must not be used. Languages and platforms implementing hidden multithreading (Go, Node.js) are not allowed.
- Respond to
GETwith status code in{200,404,403} - Respond to
HEADwith status code in{200,404,403} - Respond to all other request methods with status code
405 - Directory index file name
index.html - Respond to requests for
/<file>.htmlwith the contents ofDOCUMENT_ROOT/<file>.html - Requests for
/<directory>/should be interpreted as requests forDOCUMENT_ROOT/<directory>/index.html - Respond with the following header fields for all requests:
ServerDateConnection
- Respond with the following additional header fields for all
200responses toGETandHEADrequests:Content-LengthContent-Type
- Respond with correct
Content-Typefor.html, .css, js, jpg, .jpeg, .png, .gif, .swf - Respond to percent-encoding URLs
- Correctly serve a 2GB+ files
- No security vulnerabilities
- Put
Dockerfileto web server repository root - Prepare docker container to run tests:
- Read config file
/etc/httpd.conf - Expose port 80
- Read config file
Config file spec:
cpu_limit 4 # maximum CPU count to use (for non-blocking servers)
thread_limit 256 # maximum simultaneous connections (for blocking servers)
document_root /var/www/html
Run tests:
git clone https://github.com/init/http-test-suite.git
cd http-test-suite
docker build -t bykov-httpd https://github.com/init/httpd.git
docker run -p 80:80 -v /etc/httpd.conf:/etc/httpd.conf:ro -v /var/www/html:/var/www/html:ro --name bykov-httpd -t bykov-httpd
./httptest.py
- Must pass test suite
- Must pass load test
- Must use all CPUs
- Perfomance must inrease with increasing number of CPUs
- Perfomance must be comparable with nginx (same order of magnitude)
- No errors allowed