Live data from Hacker News

Achieving 100k connections per second with Elixir

stressgrid.com

51–60 of 117 posts

Re: Achieving 100k connections per second with Elixir

#51

Is Elixir/Erlang considered superior to Go for writing high concurrency web servers?

As far as from my tests and what I've seen reported online, Go and Rust have a substantial lead (20% ish) over Erlang for high throughput servers.

EDIT: I believe this is partially due to Go being a lot more CPU efficient overall than Erlang (see below). So for simple servers, Go and Erlang will match performance, but for slightly more complex web servers that need to crunch some data, Go [and Rust] will outperform the Erlang VM. https://stressgrid.com/blog/benchmarking_go_vs_node_vs_elixi...

Re: Achieving 100k connections per second with Elixir

#52

> What this means, performance-wise, is that measuring requests per second gets a lot more attention than connections per second. Usually, the latter can be one or two orders of magnitude lower than the former. does anyone know how does 100k connections compare with other servers?

Java was able to that for the longest time. I remember seeing async io based servers doing 500K or 1M connections per machine in the last ten years. In all cases they needed to reconfigure the OS kernel since that's where the bottleneck was.

Re: Achieving 100k connections per second with Elixir

#53
post #49

Earlier quoted context omitted.

> I was talking of single-request connection. Yes. Which is not what's being discussed here.

Yeah, what's being discussed here are connections without any i/o over them. Just an fd lingering somewhere in an epoll pool. Which obviuosly is even less taxing. So your point is?

..that you are comparing apples and oranges, like he said

Re: Achieving 100k connections per second with Elixir

#54

Even if connections per second can be a magnitude or two lower than requests per second this result is still quite off by today's alternative. 14 core machine comparing .net core with other top webservers: https://www.ageofascent.com/2019/02/04/asp-net-core-saturati...

A lot of folks are failing to read the article. They're intentionally holding each connection open for 1 whole second. This is a whole different ballgame than benchmarks where each connection is allowed to terminate as rapidly as it can send back a plain text response.

Totally missed that. In that case it does make sense.

Re: Achieving 100k connections per second with Elixir

#55
post #51

Is Elixir/Erlang considered superior to Go for writing high concurrency web servers?

As far as from my tests and what I've seen reported online, Go and Rust have a substantial lead (20% ish) over Erlang for high throughput servers. EDIT: I believe this is partially due to Go being a lot more CPU efficient overall than Erlang (see below). So for simple servers, Go and Erlang will match performance, but for slightly more complex web servers that need to crunch some data, Go [and Rust] will outperform t…

I would add the detail that for both erlang and elixir, running in one core, multiple cores, or multiple machines is seamless. Clustering is easy.

Re: Achieving 100k connections per second with Elixir

#56
im a simple man. i see Elixir, i upvote.

that being said, this article was pretty informative. The bit about the proposed SO_REUSEPORT socket option was really interesting. Really fun to read about performance bottleneck detection and improvement.

edit: wow, downvoting for making a simple joke about liking elixir. Cool.

Re: Achieving 100k connections per second with Elixir

#57

Is Elixir/Erlang considered superior to Go for writing high concurrency web servers?

Not na expert in any of the languages by any means, but Go and Erlanger/Elixir focus on different things:

- Go wants to be performant at high concurrency scale

- Erlang/Elixir wants to keep running at high concurrency scales, whatever the issues are in your application code. Performance comes second.

There's no clear cut answer to your question; I guess if you trust yourself to write servers that will hold a large number of connections while doing a lot of processing then Go has an advantage, otherwise you should probably trust the man-centuries behind the BEAM VM and follow the various blog posts/presentations explaining how you can fine-tune your machine to get to super large scales.

Re: Achieving 100k connections per second with Elixir

#58

Is Elixir/Erlang considered superior to Go for writing high concurrency web servers?

Depends on the definition of superior.

If it's pure benchmarks, then Go is usually going to come in a little bit ahead.

When you get into comparing language design, underlying architectural decisions, problems solved/created/avoided by those decisions it gets more complex.

I did a big write up for code ship a couple of years ago. Had a solid discussion on HN and the comparison remains fairly accurate.

https://news.ycombinator.com/item?id=13497505

Re: Achieving 100k connections per second with Elixir

#59

Is Elixir/Erlang considered superior to Go for writing high concurrency web servers?

I don't know Go, but that probably depends on your goals. To quote myself from elsewhere:

> Efficiency in the BEAM is mainly in service of its primary goal of fault-tolerance. If one process crashes unexpectedly, the others should continue. By the same logic, if one process is CPU-intensive or IO-blocked, the others should keep making progress smoothly. And if processes are good for isolating errors and performance issues, they should be cheap enough that we can run a lot of them at once. Those assumptions are baked into how the BEAM manages processes.

If raw speed is your only goal, the BEAM probably isn't the best choice. If consistent speed and stability matter, it may be.

More on this at https://dockyard.com/blog/2018/07/18/all-for-reliability-ref...

Re: Achieving 100k connections per second with Elixir

#60

Is Elixir/Erlang considered superior to Go for writing high concurrency web servers?

In terms of raw performance, Go will be faster. However, the differentiator here is that the BEAM gives you the guarantees and tools to write highly concurrent applications with a sane mental model, fault-tolerance, and isolated processes. As a sibling said, it's fairly easy cluster applications. Additionally, if something truly needs to be ran in another language for performance, you can write a NIF in Rust or something and execute it from Elixir.
Post reply on HN