A response to "Erlang – overhyped or underestimated" (2010)
jlouisramblings.blogspot.com
jlouisramblings.blogspot.com
Erlang has been around for a looong time (it's about as old as C++). It never rose to any real prominence, nor has it dominated any well-defined niche. Sometimes, outcomes like that are just a matter of bad timing. But sometimes, people just try your thing, don't like it, and the best response isn't "actually, you just don't get it" - it's to learn and iterate.
Is that not the case?
> In February 1998, Ericsson Radio Systems banned the in-house use of Erlang for new products, citing a preference for non-proprietary languages. The ban caused Armstrong and others to make plans to leave Ericsson. In March 1998 Ericsson announced the AXD301 switch, containing over a million lines of Erlang and reported to achieve a high availability of nine "9"s. In December 1998, the implementation of Erlang was open-sourced and most of the Erlang team resigned to form a new company Bluetail AB. Ericsson eventually relaxed the ban and re-hired Armstrong in 2004.
I know this seems like a black mark on Erlang. I think it just demonstrates the difficulty of carving a new niche. Training developers in a new language and paradigm is hard.
Then later, I found myself doing things in other languages … and I realized what I was trying was significantly less effort in Erlang and I was poorly reinventing ideas from OTP. That was when I pivoted my career to seek out teams that work with Elixir.
Some years later, when I finally got around to learning and using Node.js, I realized just how poor the async/await/promise design Node.js was (error-prone by design). But I highly doubt I would convince anyone to really give Elixir or Erlang a go.
In my case, it was certainly a case of "it's great but I just didn't understand it".
IIRC Elixir got a pretty big boost early on thanks to folks making the jump from Rails to Phoenix, so it could kinda be the case that most of the folks who *would* give it a shot *have already* given it a shot.
That being said, I have the impression that you'd have more success with folks using Node.js than you might think. I expect there would be more pushback from folks using, say, Golang and Java... if only because the wider dev community doesn't look down its collective nose at those languages quite so much. (Unless you're talking about generics or null values, respectively!)
The wall I run into starts with, “what do you think of Typescript?”
I don’t try very hard though. At most, I put out feelers and see where it goes, because it is impractical for my team to switch to Nodejs. Due to the nature of the work, Python is a better choice for the team even if I think Elixir can still work better for me.
Erlang incorporates great ideas, but using it for a project seems a bit risky, since it is quite different from other mainstream languages.
Go is more conservative, but less risky. It's just a C for today's world. I've had lots of success using it, even though I'm aware of its warts (especially when it comes to concurrency).
That said, I'm kind of excited about Gleam. Let's see how that works out.
It's also good to remember Go itself wasn't always risk free though, every new tech has growing pains.
https://www.kickstarter.com/projects/2066438441/haunts-the-m...
https://www.kickstarter.com/projects/2066438441/haunts-the-m...
The warts with respect to concurrency? That's the one thing Go does well! The real warts are associated with error handling.
It's so weird to me when people make statements like this and it makes me wonder how many times I've been swayed by someone's opinion online who doesn't understand the fundamentals of what they're talking about (or they do, and they just have horrible taste).
Node.js's asynchronicity is quite literally one of the, if not the, best part of Node.js.
You have no idea what the person you're talking about knows or doesn't know, so your comment is ironic.
> Node.js's asynchronicity is quite literally one of the, if not the, best part of Node.js.
But enough about your emotional life. Do you have any interesting reason for saying this?
There are many other parts of Node.js which need work, but it's weird when the thing to call out is its asynchronicity when that part of the language is usually the thing people like.
It's very easy to write non-deterministic bugs with async/await. Bugs that might result in flaky tests and incorrect code getting checked in.
That’s fine if that is your opinion. Here is my perspective on it:
- Node.js async model is not unique nor innovative. There has been several other platforms (such as Tcl/TK or 90s Windows programming). It runs into the same problem with any cooperative concurrency control, where a block of execution can freeze out everything else. In contrast, the Erlang/Elixir has a preemptive scheduler
- Nodejs’s async/await has an implicit queue of execution blocks. Erlang/Elixir, on the other hand, queues _messages_ recieved by a process. This allows not only transmission of data, but also control signals (such as suspend, stop, restart), which you cannot do with Nodejs promises alone. You have to use event emitters, whereas every Erlang/Elixir lightweight process can receive event messages.
- Nodejs promises can get lost. If it is not held and tracked somewhere, you can’t get to it. Erlang and Elixir has a first-class, PID literal. You can pull up any running process because the scheduler tracks them, which makes live debugging or mitigations possible in prod
- Because Nodejs queues execution instead of messages, it has to use callbacks. The problem with callbacks are not necessarily callback hell so much as tracking rejections and errors. Every single async call requires it, whereas in Erlang and Elixir, a running process is a natural error isolation boundary.
- Nodejs only occupies a single core of a processor, unless you use workers or fork. The BEAM runtime (these days) will use up as many of the cores as available unless you tell it not to. I can run a single BEAM os process, but have to jump extra hoops to take advantage of that for Nodejs.
Those are the main reasons why, from my perspective, Nodejs is error prone by design.
There are times when the masses are just wrong. The Whatsapp story probably isn't possible with some other technology stack.
Of course, maybe it's just that very few applications need to scale in the way Erlang enables.
It seems Erlang is comfortable in the niche of "real-time messaging platforms"
https://discord.com/blog/maxjourney-pushing-discords-limits-...
Elixir is Erlang with more sugar coating. The language and many of its associated projects (e.g. Phoenix) are regularly touted as some of the most productive development tools. You still don't see people flock toward them.
I used to think that large groups of people can't be wrong. Time and personal experience taught me otherwise. Now I know that sometimes it's possible that they actually just don't get it. But that's also fine.
I think functional programming in general still has a lot to teach most programmers that are writing code in the most popular languages today. That doesn’t mean I think they should be using different languages primarily. It means I think they should make their own environments better by learning what others have figured out before them.
Erlang has seen plenty of success IMO.
The problem with not using Erlang and Elixir is that people are continually inventing a worse wheel. If you need a scalable system controlling many things robustly and reliably, anything built to solve that problem will be an approximation of the solution provided by Erlang/Elixir.
(source: https://erlangforums.com/ )
Seems like a pretty good outcome to me?
People don't just try things. And they judge things they havent tried. They stick with what they know. They all got taught java in school, so thats what they use.
This is probably "not a good idea", as processes introduce bottlenecks. Really, if you want to abstract in erlang, you should, in 95% of cases really just write a behaviour.
Of course if you need to abstract over something stateful, yes, please write a process. The benefit being that you can do some pretty painless dependency injection (or at a minor readability cost compile time pick between modules) and inject the state in your tests.
https://elixirforum.com/t/getting-each-stage-of-elixirs-comp...
Should we be shaming those libraries?
@type trace_id :: nonempty_binary()
@spec put_trace_id(trace_id()) :: term() | nil
def put_trace_id(id), do: Process.put({:my_app_name, :trace_id}, id)
@spec get_trace_id :: trace_id() | nil
def get_trace_id, do: Process.get({:my_app_name, :trace_id})
@spec make_trace_id :: trace_id()
def make_trace_id, do: Base.hex_encode32(:crypto.strong_rand_bytes(16), padding: false)
It does require that, along the call path, you set that trace id whenever a new process is started. It gives you some visibility into what's going on, especially if you also do something like Logger.metadata(trace_id: get_trace_id()) after you call put_trace_id/1That said, I think any library that does start processes like that should have some mechanism that lets us identify the provenance of the crash. "Crashed when trying to fribulate. Trace id xxxxxx"
A separate process can own its responsibilities.
I'm not enough of a parser expert to know whether stateless processing is possible, but that's how I can see a simple xml parser ending up in a separate process.
Don't do that. Use state tracking data type.
"the main process"
That's not a thing in the BEAM.
For something pure compute (i.e. no need for connection pools), if your user really needs that, then they can run the xml parsing in their own spawned process. Even if it's I/O bound, Erlang VM already makes great decisions about yielding, you will almost certainly not do better. You should not make concurrency decision on the users behalf.
One thing I was tasked with was replacing the ingress data collector. One of the limitations of Erlang at the time was that all SSL termination was funneled through a single core. Once the Java replacement was deployed, we saw a massive decrease in latency, the p95s and p99s especially, and all the weird operational overhead of trying to understand what the Erlang VM was doing at any given moment.
Say what you will about Java and the JVM, but it's a fantastic platform for reasonably high performance servers. Erlang might have a lot of claims for high concurrency and scalability, but practically I've had considerably more success with the JVM.
I haven't touched Erlang since 2013, so in the intervening 11 years I can only hope that it has gotten better. Though I have zero interest in trying it again.
A response to "Erlang - overhyped or underestimated" - https://news.ycombinator.com/item?id=2039180 - Dec 2010 (33 comments)
Erlang - overhyped or underestimated? - https://news.ycombinator.com/item?id=2038392 - Dec 2010 (38 comments)
Keep in mind, it's frozen temporally at that point in time, and a ton of stuff has changed in computer ecosystems since then, and so has some of my viewpoints.
The VM is what people really want, but for some reason no one ever talks about using the VM with another language or cloning the VM for another language instead of trying to force the part that people don't want (language) with the part that works.
> The main objection is familiarity: “It doesn’t look like Java!” I think the point is somewhat moot.
It doesn't matter what the zealots think. It's not moot, because there are people born every day that will think it. This will be a response to the language, every day, until we're both long-dead. It matters enough that it drove people to dedicate time to develop entirely new syntax (eg elixir), as mentioned. Given the myriad of languages that use a functional style, Erlang is just not special, excepting the unique syntax which makes it unfamiliar and elixir that just makes a bit more user friendly. Maybe, just maybe, it is partly about the syntax.
The Erlang tooling is primitive. I don't want to develop another toolchain and have to do with the gaps, thx. Yes it's a chicken-vs-egg thing, but without support for a new language, you wont see a lot of adoption.
The semantics are less efficient. Now the context needs to be carried around or in another set of terms, or worse another event queue, or worse overloaded fns? When a for-loop has to be broken up into 2 fns, you've made things worse at the smallest scale. I then have to communicate the naming and choices to future developers? This makes debugging, design and code reviews harder/more divisive.
I can read through a couple functions and understand what a c-like program does, even if it's in Python or PHP or Java or C (most of the time). Saying they are different in details, is missing the point. I don't have to know how data is split up because everything is either a structure or a scalar, serially processed and in static locations for reading...until you hit a DB. Hitting a single async store is complicated enough that it has caused developers headaches for decades. Introducing easy queues as a solution, is handing out footguns. The complexity introduced into event-driven applications, limits the practical complexity of application development in practice, by orders of magnitude (bottlenecks and race conditions).
Sloppy programming is jr friendly. Raising the developer performance expectations higher, is worse for adoption. Perl died on this hill.
Years after I last used Erlang to replace a Java chat client from 5000 lines to single page Erlang module, then got a job writing it (2009), I would not recommend it to anyone. I did try cracking open another person's project in 2012ish and that was not fun. At least we have Kafka.
Some things are just a little *too* different. There's no for-loop, it's just recursion. Pattern matching on the function signatures are nice, but then I have to dig around a lot more to find what I need.
That being said, I do want to try it and learn about it more; the promises it makes about concurrency and event driven programming looks nice, i do really want to try it.
I don't miss having a for-loop, recursion works but the Enum module is great and easy to use. When done right, pattern matching on function signatures is nice and clean. If you find it's actually more difficult to find what you're looking for it's a sign somethings probably off.
Erlang is some inexplicably sacred cow on HN, among the few other forums who still discuss it. Making sweeping changes is going to be required, to get the adoption that some are seeking...specifically the authors of these kinds of posts. Waiting another couple decades for the killer app to catapult it, will never happen.
What is the reason it's not popular again? My reasoning is not "a bad take", as much as it's my take from over 30 years programming. I would say it's my own twist on common understandings across the west coast of the US.
You probably have your own, equally wrong reasoning. Would be great to hear them.