Recently while thinking about indie hacking I went on a tangent, researching the topic on how to improve performance. It's usually a long shot to think about performance early on development stage while product does not have proven usage. But it's a dream come true when the problem your app begin to have is a problem of performance. So this curiosity lead me to https://www.youtube.com/@AntonPutra channel that have several performance tests done under heavy load. A lot of his tests showcases that actually while some solutions might have initial higher latency (long response time) under almost no load, the same solutions might end up more performant under heavy load (like DDoS of 80K requests per second!).
So here I would like to make a comparison and podium under several categories on which option in each category is most performant. Keep in mind, that very often it's a game of trade-offs, and taking only performance in mind while building your app you might end up with unmaintainable app. Usually going with something you know will actually help you move faster, and then rewriting bits and pieces to more performant option is a way to go. Anyway, without further ado, let's get into it:
Top load balancers
Recently the hierarchy has been violated with release of Pingora by Cloudflare. So first spot might surprise you.
- Pingora by Cloudflare
- Nginx
- Caddy
- Traefik
While Traefik is one I used the longest, Nginx was my bread and butter for the longest. Even though Pingora is the new hot stuff around the block, I would still wait a little until it's fairly established.
Top backend languages
This one might be most opinionated, because a lot of developers get attached and emotional about their favorite language. I'm language agnostic to be honest (I have my own opinions and preferences of course), but I'm looking purely on how much load and latency each can produce in typical backend stack: framework, CRUD and Database. That's why I like Anton's analysis, because it tests both static content load, and CRUD ops load as well. And based on that we have:
- ZIG (+ ZZZ as potentially best framework)
- RUST (actix, however axium and rocket not very significantly behind)
- GO (stdlib / fasthttp, depending on case)
- Java + Quarkus + GraalVM
- c# dot.net
- Ruby (no Rails, Rails actually slows down Ruby to fall behind JS)
- JS = Bun > Deno > Node.js
- Python (FastApi)
The key takeaway for me is that a lot of those technologies got very close to each other in terms of performance. Throughput and latency really starts to fall apart after node.js. Another one is that framework overhead can actually be one of the biggest bottlenecks in terms of performance.
I would group these into 3 groups of solutions: Top Performers (Zig, Rust), High Performing Enterprise (GO, Java Native, c#, Ruby Native, Node on Bun), Framework Performance (Rails, Fastapi, Django, Spring etc.).
If we are talking about frameworks, let me cover only two backend languages in that regard.
Top Java Frameworks
The list is pretty short in that terms:
- Quarkus
- Micronaut
- Spring
This is done by my own testing on docker containers in localhost. Unfortunately I don't have funds to spin up AWS Infra like Anton, so I'm unable to test heavy loads on infra, but I have my lab micro PC, that I can imitate that somehow over local network. If you are interested in that, let me know in the comments.
Top JS Backend Frameworks
- Encore (Far up front)
- Elysia (Bun's favorite)
- Hono
- Fastify
Recent Node.js backend frameworks basically managed to drastically improve performance, effectively closing the gap between Node backend and GO backend in terms of performance. No wonder because Encore is basically Typescript run on top of Rust runtime. While Encore claims to be 50% faster than Elysia, Elysia by itself is built for Bun, which is actually rewritten in ZIG. So while technically you are writing Typescript, both those frameworks are leveraging capabilities of two most performant new languages out there.
Top JS Frontend Frameworks
- Astro
- Svelte
- Remix
- Gatsby
- Next.js
No surprise for me here. I've been in love in Astro since the beginning. First truly meta framework that you can mix and match with others. This podium is based on Page Vitals and Lighthouse metrics, because we are talking mainly about static content. In simple terms it refers to: how fast page loads and how much overhead framework itself adds. And while Astro itself feels closer to Next.js in terms of usability and convenience, static build is actually one of the smallest. Server build however might not be up to par with top performant backend frameworks, unless it is running on Bun, so keep that in mind.
Top Databases
- SQLite
- MongoDB
- Postgres
- MariaDB
- MySQL
First place might surprise you. I was surprised myself, but actually it's obvious. Think about it. All other solutions work over network protocol. SQLite directly saves to disk drive. It's only bottleneck is disk space, and disk speed. And recently libsqlite (thanks to turso) pushed it even further. To be honest I was more surprised that MongoDB outperforms Postgres in terms on how much more inserts and updates are more efficient. Partially it's due to the fact, that by default, Mongo flushes the state every 100ms, while Postgres saves right away. Either way top 3 will always be a solid choice.
Top caching / Key-value store
- Memcached
- Redis (better Throughput) / Dragonfly (better Latency)
Memcached is clear winner by a landslide. Of course any solution at this point will improve performance, but memcached won't have a rival for very long time.
Conclusion
While being sidetracked from my other projects, this research gave me something to think about when choosing stack for my next application.
I think this is not a total revelation for those who work long enough in the industry, but still this results shows how convenience is often trade-off for performance. You have to pick your poison. In 1 year time, or even 6 months, this might be outdated, given how Zig and Rust moved things forward in terms of performance across many solutions. For me, it's a question whether I should consider dipping my fingers in Rust or Zig, or should I settle with encore as a good enough alternative. On the other hand, Mongo is database I know, but never considered for production, and now I know I shouldn't disregard it that fast.
The point is that by tweaking some decisions early on, you might avoid a complete rewrite of your application as soon as it takes off.
Top comments (0)