How many cores is practical for top performance?

I’m not much of a hardware buff, so please excuse my ignorance.

Let’s say I want to build a machine to maximize the performance of some arbitrary elixir service that I’ve built; does it make sense to simply add more cores to scale up the amount of concurrent processes my elixir-based service can parallelize? Does it scale linearly? How should I go about determining the optimum number of cores for my project?

Let’s say, for example, that I have somewhere between 10 and 30 genserver instances subscribed to some external service via websocket (each having its own dedicated websocket), and then I also have some additional processes for my frontend and things like the supervisor. And this is just an arbitrary example for the sake of discussion.


Maybe reading this article will help:

If you have been paying attention on Twitter recently, you have likely seen some increasing numbers regarding the number of simultaneous connections the Phoenix web framework can handle. This post documents some of the techniques used to perform the benchmarks.

or maybe you prefer to see this conference talk about it:

Both of them will give you more insights into what you are trying to understand, but will not give you a formula :wink:

1 Like

In a normal high-performance language like Rust I’d say look for some parity between CPU cores and memory channels. F.ex. having 10 CPU cores (20 threads) and a 4-channel memory can make the machine not use its full potential in very memory-intensive apps – of which there aren’t that many, to be fair.

With a language like Elixir though you could easily have a 64-core CPU even with 4-channel memory (like the Threadripper 3990X) because Elixir is not a high-performance language and you’d likely want Elixir for I/O bound workflows because its green-thread preemptive concurrency model will net you insane benefits.

So if you want to focus on Elixir then you can get a lot of cores even if they are a bit slower.


The “getting to 1M websockets” stuff is 1000% worth reading / watching, but the big takeaway from that work is pretty simple: the way you figure out these things is to MEASURE.

1 Like