Which Web Framework is Faster?
Basic out of the box Web frameworks performance comparison
There are numerous of backend web frameworks for different programming languages. Each of them comes with its own advantages and drawbacks. And it is not a simple task to answer the question "Which framework is the best?". But we can looks at the topic from different perspectives. And performance is a simple metric (yet just one of many) that is measurable and gives an answer to "which framework is faster/fastest?"
The purpose of this project is to attempt to measure a performance of different web stacks as they come out of the box, with no code added.
Results
Test was performed with ApacheBench tool performing 10k requests with concurrency level 10.
ab -n 10000 -c 10 http://127.0.0.1:port
Framework | Web Server | Time taken | Requests per second | Time per request | Longest request |
---|---|---|---|---|---|
Express | Node.js/http | 5.7s | 1744.5 | 5.7 ms | 184 ms |
Flask | waitress | 9.0s | 1109.6 | 9.0 ms | 130 ms |
Sinatra | Puma 5.4 | 16.4s | 608.8 | 16.4 ms | 239 ms |
Django | WSGIServer | 21.9s | 455.7 | 21.9 ms | 62 ms |
Rails | Puma 5.4 | 138.4s | 72.2 | 138.4 ms | 1171 ms |
Laravel | nginx | 378.5s | 26.4 | 378.5 ms | 1042 ms |
Note: Ofcourse there are a lot of variables that influence application performance. A lot depends on a web server that you put in front of your application, so numbers above may vary in different configurations. The test was performed with webservers that are typical for the stack just to have a picture of how performance of those frameworks compare to each other.
You can test it yourself
In order to perform tests yourself you'll need to run this project with Docker, so make sure that docker app is installed on your machine.
git clone https://github.com/alchaplinsky/wfpc.git
cd wfpc
docker compose up
Perform tests>
ab -n 10000 -c 10 http://127.0.0.1:port
License
MIT © Alex Chaplinsky