Benchmark HTTP Latency with wrk
Recently I started reading through Actix-web, Django,tokio etc, so thought of bench marking the latency. Started with Django as it is pretty easy get started and its in python.
looks like wrk ( https://github.com/wg/wrk ) is a good tool to start with.
"wrk is a modern HTTP benchmarking tool capable of generating significant load when run on a single multi-core CPU. It combines a multithreaded design with scalable event notification systems such as epoll and kqueue."
Installation also pretty easy in Ubuntu:
1. sudo apt-get install build-essential libssl-dev git -y
2. git clone https://github.com/wg/wrk.git wrk
3. cd wrk/
4. sudo make
5. sudo cp wrk /usr/local/bin
Run your Django server using
python manage.py runserver
then another terminal you can run your wrk as below
wrk -t12 -c400 -d30s --latency http://127.0.0.1:8000
I only had single page and not much custom files in the Django and not data base request. Not sure this is a good response .. Please share your comments.
Also got something like this Django logs as well.
[27/Mar/2021 17:39:14] "GET / HTTP/1.1" 200 196
[27/Mar/2021 17:39:14] "GET / HTTP/1.1" 200 196
Exception happened during processing of request from ('127.0.0.1', 33856)
[27/Mar/2021 17:39:14] "GET / HTTP/1.1" 200 196
[27/Mar/2021 17:39:14] "GET / HTTP/1.1" 200 196
I am planning to try this same experiment with actix-web and Rust , will share once I have something..