Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I see your point to a degree.

That's kind of how Erlang is. At first, anything Erlang has, some other system has too:

Isolated process heaps? - Just use OS processes

Supervision trees? - Use kubernetes.

Message passing? - Not a big deal, I can write two threads and a shared queue in Java.

Hot code loading? - Java can do that too

Low latency processing? - I can tune my LMAX disruptor to kick Erlang's butt any day.

Now getting all that into one platform or library that's the main idea. OS processes are heavyweight. Running 2M of them on a server is not easy. You could use some green threads or promises but now you lost the isolated heap bit.

You can use kubernetes to some degree but it does not do nested supervision trees well. I guess it would work, but now you have your code, and you have pods and controllers, and volumes and all the shit.

You can do message passing with an "actors" libraries in many language. But you cannot do pattern matching on receive, and it doesn't transparently integrate with sending it across nodes to another thread.

You can do hot code loading, but how do you deal with runtime data structure and state. Erlang is built around that: gen_servers since the state is immutable and explicit has callbacks to upgrade not just the code but the state itself.



The BEAM's real special sauce is in its preemptive scheduler in that it is impossible for one process to take down the whole system, even if bad processes are eating up the entire CPU. This cannot be done in any other language.


Worth noting as a disclaimer for people reading this: this is only true so long as external interfaces are not used. As soon as the BEAM calls out to other binaries, you lose that guarantee.


A disclaimer to the disclaimer is that you should be isolating that binary on dedicated nodes if there are stability concerns. Inter-node communication is trivial on the BEAM and it can be tweaked in the future when the scale of the system calls for it.


If you write an Erlang function in C you can actually call a function that lets the scheduler know you are willing to yield.


I know this is minor to your point, but I think you can get pattern matching on receive with Akka Typed.


That's a fair point. Akka did go pretty far, this is pretty neat: https://doc.akka.io/libraries/akka-core/current/typed/intera...


> Isolated process heaps? - Just use OS processes

OS procs are heavyweight. Erlang procs are ~2KB each. You can spin up millions on one box while traditional OS procs would melt your machine. Not even in the same league.

> Supervision trees? - Use kubernetes.

Comparing Kubernetes to Erlang supervision trees misses the mark. K8s is infrastructure that requires significant configuration and maintenance outside your codebase. Erlang's supervision is just code - it's part of your application logic. And those nested supervision trees? Good luck implementing that cleanly in K8s without a ton of custom work.

> Message passing? - Not a big deal, I can write two threads and a shared queue in Java.

Basic threads and queues don't compare to Erlang's sophisticated message passing. Pattern matching on receive makes for cleaner, more maintainable code, and the transparent distribution across nodes comes standard. Building equivalent functionality from scratch would require significantly more code and infrastructure.

"Any sufficiently complicated concurrent program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Erlang."

> Hot code loading? - Java can do that too

Java can reload classes, but Erlang was designed for seamless evolution of running systems. The gen_server callbacks for upgrading state during hot code loading show how deeply this concept is integrated into Erlang's core.


It's funny reading your response because I think you skipped the second half of the comment! Your rebuttals to the rebuttals are pretty similar.


its friday my brain is cooked - you're right.


No worries, at all I had figured you'd notice eventually. But I essentially agreed with you was just saying that common perceptions and how Erlang managed to do well there.




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

Search: