Hacker News new | past | comments | ask | show | jobs | submit login
How much memory is needed to run 1M Erlang processes? (hauleth.dev)
29 points by todsacerdoti on June 10, 2023 | hide | past | favorite | 8 comments



Author here. If you have any questions, here I am.


Not an erlang dev here, but isn’t this blog optimizing for the benchmark, by cutting features that we would have needed in real-world scenarios ?


Yes it is. Though until the last paragraph everything is done more or less to be an idiomatic approach to this task rather than "just optimisation". The VM flags part though is solely "optimizing for the benchmark, by cutting features that we would have needed in real-world scenarios". The "RemoteCall" code is pretty idiomatic approach to such problem.


i have the feeling the very first optimization ( not using the VM real green thread, but something lighter that doesn't provide debugging tools) is also something you wouldn't like to have in the real world..


It is using VM green thread, just more primitive one. Just to be more like other implementations (except anode) in original article that do bare minimum to run. Also, this isn't that unusual to use just `spawn/1` for simple and short "one-off" processes.


Less that 1 GB... that's impressive! Now I'm wondering how much memory Go or Java would require.


It is in the original article [1], though I was made aware that Go implementation is also incorrect as `defer` in it make the memory usage to substantially raise. So instead of:

        defer wg.Done()
        time.Sleep(10 * time.Second)
In original article it should be:

        time.Sleep(10 * time.Second)
        wg.Done()
And memory usage will drop about 2x. I am no Go nor Java developer so I cannot say anything more.

[1]: https://pkolaczk.github.io/memory-consumption-of-async/


Heh Heh Heh, now do Python... ;)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: