Understanding Elixir/Phoenix performance

Nice !

Now what if we spawn a different process for working over each directory and then collected the result, after all of them are done, something like the async_stream/3 function of the Task module might help. This although not a fair comparison with other languages, but might lead to huge performance benefits.

I think it hasn’t come up in this thread yet, but part of why it is so good with IO is that Elixir (Erlang) can avoid wasting a lot of CPU and RAM by avoiding doing expensive string concatenations in the first place (which is a very common need for web servers). The ecosystem (e.g. EEx, Phoenix…) is heavily relying on IO data instead of simple strings/binaries, which allows some critical parts like templating to be blazing fast and memory efficient. Although quite technical, the Template of Doom article is definitely worth reading.

4 Likes

Correcting my own post: I realized I was technically incorrect in the sense that EEx is not using IO data and does not support it out of the box, but the Phoenix.HTML EEx engine implements it (sorry for the confusion). Also I should have included this other interesting post on the topic.

3 Likes

Must see performance in real world .

If you want serving to Over 300K request per second in a single Machine, and this serving is real-time Searching or transaction processing with Database

Elixir
Phoenix
Mnesia ( in-memory, extermely Fast DB )

Is single Solution in The world :wink: