Web REST API Benchmark on a Real Life Application

Mihai Cracan
Aug 2, 2017 · 4 min read
Image for post
Image for post

Working as a web freelancer I am interested in how different frameworks and technologies perform, but the majority of the benchmarks found over the internet are considering just the Hello World example.

When you are building a real life application there are more aspects to take into consideration, so I decided to run a complete benchmark between the most popular frameworks and technologies.

Alongside the performance, I was interested in how easy is to achieve specific tasks in each framework and what is the cost of scaling the application performance.

Who are the candidates

  • Lumen 5, PHP 7.0, Nginx
  • Express JS 4, Node.js 8.1, PM2
  • Django, Python 2.7, Gunicorn
  • Spring 4, Java, Tomcat
  • .NET Core, Kestrel

What are we testing

How server configurations look

  • 1 CPU, 512 MB - $5 / month
  • 4 CPU, 8 GB - $80 / month
  • 12 CPU, 32 GB - $320 / month

What are we building

  1. Hello World - simply respond with a JSON containing Hello World string.
  2. Computation - compute the first 10.000 Fibonacci numbers.
  3. Simple Listing - we have a MySQL database containing a countries table and we’ll list all the countries.
  4. Complex Listing - we add a users table alongside a many-to-many mapping between users and countries and we want to list all users that visited France, alongside all countries each one visited.

For building the last two endpoints we’ll use the tools each framework provides to achieve our goal in the easiest possible way.

How are we testing them

These tools will run on their own droplet created on DigitalOcean so they don’t compete on server resources with the actual API application.

Also, the server used for placing the test requests and the one used to run the application are linked using their private IP so there won’t be any noticeable network latency.

Benchmark results

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

How the API is built

Laravel and Lumen with PHP

Express JS with Node.js

Django with Python

Spring with Java

.NET Core


However, the performance of the Node.js with Express JS is quite remarkable. It competes with technologies such as Java and .NET Core or even outperforms them and combined with the simplicity of Javascript ES6 which you can natively use with Node.js 8, it provides so much power.

Regarding application scalability, the best performance per cost was gained on the middle size server. Adding 12 cores and 32 GB of memory didn’t help too much. Maybe, in this case, the bottle neck is somewhere else or it requires fine tunings to unlock the full server potential.

What do you think?


Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store