How good is Elixir throughput?

Is really elixir (especially with phoenix) has good throughput? I’m recently seeing a lot of benchmark and “real use cases” benchmarks where elixir is loosing with asp .net, jvm etc.

1 Like

Would be nice if you could share links to the places you see those benchmarks. Not saying they are flawed, but have seen too many flawed benchmarks to assume they are correct.

In real case benchmarks it makes most sense to compare whole ‘stacks’ including for example database adapters and caching layer. But then is requires the author to know all stacks good enough to prevent pitfalls.

For most use cases the throughput does not matter that much by the way. The difference between 250k req/s and 80k req/s is 0 when you only need 2k req/s. Most times the throughput of features (development speed) is a more important factor, so is stable memory usage (spikes as costly) and uptime and that’s where Elixir shines without a doubt.

And scalability of course. It’s easier to have one large instance then 10 smaller ones (caching, sessions etc). Not all languages take full benefit of larger instances / more cores)

2 Likes

www.techempower.com/benchmarks
Gap is huge

What are you considering Elixir for?

Yes, Elixir and Phoenix have a level of performance suitable for most existing web apps (it is better than Python, Ruby, which dominate web development world) . But performance is not the brightest side of Elixir, and it was never supposed to be like this

API endpoint and backend core for e commerce

I don’t expecting best performance, I’m expecting fail protection ( Elixir winning here ) and good throughout ( mainly for HTTP API requests )

Elixir is a great fit here, I even have experience in Ad Exchange development. We used Clickhouse, Elixir, pure Plug, RocksDB and bare-metal hosting with prioritized high throughput connection

3 Likes

Are you projecting more than 50K requests per second?

If no, Elixir is going to be quite enough and always will be.


Below added for context:

5 Likes

Does anyone even care about those benchmarks anymore? They were a bit of a novelty when they first came out but I think most people pay very little attention to them these days.

What’s more meaningful is real-world usage. From their top ten - is anyone actually using any of them in production? (Which apps?) And if so does their feature set compare to Phoenix - or will you have to add X number of libraries or roll your own to make them even as half as feature-rich? (And how will that impact their performance?)

1 drogon-core 616,607 100.0% 0 Ful C++ Non Non Lin Pg Lin Raw Rea
2 xitca-web 587,955 95.4% 0 Plt rs Non xit Lin Pg Lin Raw Rea
3 drogon 556,046 90.2% 0 Ful C++ Non Non Lin Pg Lin Mcr Rea
4 salvo [pg] 542,547 88.0% 0 Mcr rs rs hyp Lin Pg Lin Raw Rea
5 just-js 538,414 87.3% 0 Plt JS jus Non Lin Pg Lin Raw Rea
6 may-minihttp 520,976 84.5% 0 Mcr rs rs may Lin Pg Lin Raw Rea
7 actix-http 512,422 83.1% 0 Plt rs Non act Lin Pg Lin Raw Rea
8 axum [postgresql] 498,541 80.9% 0 Ful rs rs hyp Lin Pg Lin Raw Rea
9 aspcore-ado-pg 458,677 74.4% 0 Plt C# .NE kes Lin Pg Lin Raw Rea
10 officefloor-sqlclient

WhatsApp, Klarna, Discord, Bleacher Report, Pinterest and many others opt to use a language that runs on the Erlang VM - yet I don’t think I’ve heard of a single user of any of those above.

Ultimately the choice is yours, go with whatever fits best for you and your project… but base your decision on meaningful criteria/info :023:

8 Likes

Yes, a lot of the frameworks in the benchmark are developed for…this benchmark. For example justJS. So they skip every step not necessary for the tests to complete (validation etc).

And some people tune their favorite framework for maximum performance in the specific test (knowing 10 results are requested, so using a fixed length array…).

In the end it is (or became) more of a game leaderboard. But outside the benchmark game community I highly doubt it is usable.

If somebody has some extra time, enjoy having a look at their Phoenix repo :slight_smile:

Ps. Filter by Full Stack and Full ORM makes a major difference.

6 Likes

Not a single person who actually produces and maintains production apps. :003:

I completely lost any respect I had for them the moment I found out some of the contenders did not even use an HTTP library, they just directly compared a single string comprised of HTTP version, verb, parameters, headers, the whole thing – with zero parsing, just so they can get on a better position. :face_vomiting:

People have contacted the TechEmpower maintainers about such cheaters and they are only shrugging.

There’s zero value in that “benchmark” game. I too can wrangle machine code when the need calls for it.


@musialny.dev Your metrics should be – how easy and quick it is to develop with the technology AND is it easy to maintain when deployed to production. That’s it. Elixir covers both very well and some other languages and frameworks only cover one of these. Many of them do not cover even one of the points. :005:

One example: Ruby on Rails is relatively easy to develop with but the tech easily falls over with more server load so people just buy more servers – which eliminates the 2nd point of “is it easy to maintain in production?”.

Another example: Rust is very easy to maintain in production because you’ll only ever need one server unless you’re on a planetary scale. But making a web or API service with Rust is not easy. So this one has the both points swapped compared to Ruby on Rails.

5 Likes

What about these tried and true metrics:

  1. My boss has a friend that says X language is the next big thing
  2. X language is hot on the job market and I want to get a project under my belt before jumping ship
  3. X language is so obtuse that no one wants to maintain the app except me (job security)
2 Likes

Elixir is for me the most comfortable language I ever had to use. I just have to be sure that’s my technology choice wouldn’t be (performance) bottle neck for whole project. That’s source of my worries

Can’t argue with well-elaborated and accurate points, am I right?

1 Like

No, performance won’t drag you down. Elixir might trip you up in some places – first deployment still sucks if you are new but it does get better very quickly after you get some experience – but overall it’s also the most comfortable language I ever used.

I have 21 years of experience which is not strongly correlated to knowing WTF am I doing – or even if I am smart at all :003: – but still, here’s one more piece of anecdotal evidence for you.

6 Likes

Thanks a lot :smiley:

I led the engineering org at Papa, a YC unicorn worth north of 1.5B by the time I left.

The amazing team did a great job with Elixir.

Want to know what was the bottleneck for our performance 99.99% of the time? It wasn’t Elixir. It was almost always Postgres query tuning that saved the day.

I think this may be the case for the vast majority of apps. Stop sorting large arrays in app code, let the database to the work. Elixir will get you very very far performance wise.

15 Likes

Exactly this!
For example, Twitter had 24k tweets per second during the World Cup, and most apps don’t have that many customers :smile:
There are many other problems that are more likely to kill your project than Elixir performance :smile:

2 Likes

I made the mistake of going by the benchmarks and making the most optimal choices possible before I discovered Elixir.

I saw the Tech “empower” benchmark and since I hated C++, Java, & Golang, I decided to go with Rust.

I lost 3 months trying to make a production worthy app.

Actix Web is fast, no doubt, but I’m the one who was slowing it down with my inexperience.

I was merging a templating engine, with asynchronous approach and was using RwLock to read the templates and eventually ran across thread poisoning issue.

I was unable to see what was happening in the runtime, a problem I was sick and tired of after making a large project in Nodejs.

Monitoring and error logging was lacking, I had to figure out conventions.

I’m sure my app was the most secure of them all, not because of Rust, but because it’s never going to see the light of day.

Perhaps I should have gone with Rocket, but if you see Techempower benchmark, it’s way down even though it’s written in Rust.

So it seems; doing the right things, properly and secure and being able to run indefinitely takes much more than a barebones Actix app.


Jose Valim has a great article on this topic:

12 Likes