Skip to content

Raspberry Pi 3 Benchmark Instructions

Nikhil Akki edited this page Aug 25, 2021 · 1 revision

Welcome to Benchmark Rest Frameworks wiki page

RESTful APIs benchmark with AB tool

  1. Express - NodeJS
  2. FastAPI - Python
  3. Fiber - GoLang

Hardware

Software

ab -k -c 350 -n 5000 http://<rpi ip>:3000/
# 350 concurrent requests and 5000 total requests

Benchmarks

1. FastAPI (Python)

Sync

FastAPI Sync

Async

FastAPI Async

2. Express (NodeJS)

Sync Express Sync

Async

Express Sync

3. Fiber (Go Lang)

5k requests

fiber 5k

500k requests fiber 500k

CPU util in 500k requests test fiber cpu util

4. Async FastAPI Multi-worker

fastapi workers #4

5. Async ExpressJS Multi-worker

express workers #4

Summary

Clearly Fiber (Golang) is way ahead of the game interms of speed and raw performance. Express (NodeJS) is ~2x faster than Python (FastAPI) and the these frameworks are ~7.5 and ~11 times respectively slower than Fiber.

However, this doesn't mean that you no longer use Python or NodeJS based frameworks. Your current software stack along with the dev skills you have in your team will play an important role in making these decisions.

We use Python and Node based RESTful APIs extensively, absolute performance becomes relavent when you are doing things at scale. These benchmarks are solely in terms of raw speed / throughput and do not consider things like developement speed example - existing eco-system and available resources.

General recommendation is that you choose Python based RESTful framework when you are say working with AI/ML based services or your team knows Python well. And same goes for NodeJS based framework decisions, there is no silver bullet here!

Hope this gave you some perspective. Feel free to share comments and feedback.

Author - Nikhil Akki

Blog article Link