Benchmarking Different Web Frameworks

Usually, while developing web applications most of us are confused as which framework to pick -given the fact that there are dozens available.

Well, some of us decide on the basis of expertise one has over the others but also need to take care of different aspects related to each. I too ran into this sort of problem but luckily, I had some time to play with a few frameworks before jumping on to a conclusion.

Since I am primarily a Python developer, I was inclined towards Python based framework and having experience developing apps in Django, thought I should test Falcon (another Python framework, known for speed).

I created a simple but exactly same structured API on each of the framework. The motive was to evaluate frameworks on the basis of their capability to handle load, nothing else as of now. I also tried to add an ORM linked to a common database but that would bring the db connector framework also in picture which will vary since they are not same. So, dumped the idea for now.

The API is simple, a GET request which will fetch a JSON object consisting of two attributes -name and age. Each API will return something like this :

{‘name’: ‘Raman’, ‘age’: 22}

The tool used for profiling is Apache JMeter. The setup would be to run 100 threads in a loop of 100 iterations, or in short- 10⁴ API calls.

The machine on which I ran the tests has an Intel i5–5200U CPU with 8GB memory and Nvidia GT730M graphics chip.

The respective contenders’ controllers are shown below.

Rails controller:

Falcon app loader:

Django View:

Node entry point:

Here are the results:

Node was supposed to outperform as it runs on asynchronous event driven JavaScript runtime.

You too can run some advance tests. I have clubbed all the projects into one single repository which can be cloned.

Link to this repository :