* The JIT now does type-based optimizations based on type information in the BEAM files.
"The BeamAsm JIT-compiler has been added to Erlang/OTP and will give a significant performance boost for many applications. The JIT-compiler is enabled by default on most x86 64-bit platforms that have a C++ compiler that can compile C++17."
Also great if you have the option of deploying on AWS Graviton or similar.
(HN mods: feel free to delete this comment or my comment at https://news.ycombinator.com/item?id=31426002, since they're the same content)
The EEP doc calls it out:
https://www.erlang.org/eeps/eep-0049#elixir
"This is the most general control flow in this document, being fully flexible with regards to which values it can handle. This was done in part because there is not a strong norm regarding error or valid values in either the Erlang nor Elixir APIs, at least compared to other languages here.
This high level of flexibility has been criticized in some instances as being a bit confusing: it is possible for users to make error-only flows, success-only flows, mixed flows, and consequently the ˋelseˋ clause can become convoluted."
And also, if you wonder if you could do it for your current platform of choice, please do not engage. Inside float to string conversion lies madness...
What's your feeling on this? Elixir sounds very compelling to me, but I worry that I might be going in a direction that's not where the industry is going.
People also overestimate what “the new” is, constantly. Otherwise, PHP would be dead by now rather than flourishing.
Serverless is essentially PHP in CGI mode, with a lot of marketing behind it. There are certainly places where it’s beneficial.
Servers and databases are not going away anytime soon. They are simply too effective for what they do.
The “everything is legacy crowd” hasn’t been correct about almost anything in my lifetime. Mainframes are still going strong. SQL databases are better than ever and the NoSQL crowd has largely died out.
90% of the cloud ecosystems of today are just doing what Java app servers were doing in the late 90s.
Erlang and the BEAM offer a set of trade offs that happen to be ideal for a lot of server based use cases to make hard things really simple. Probably not going to take over the world but if it fits what you do you probably won’t want to go back.
yeah, that was rather curious. Similar to how XML died out. Not with a bang but with a whimper. Not that NoSQL or XML are completely gone today, just like PHP. But suddenly one day you recognize these topics are no longer appearing on HN or elsewhere. Then you realize you're getting old and... oh my god... we're actually stuck working in a fashion industry and nothing matters, life is meaningless, and all this is dumb dumb dumb.
When HN and other techies find a new hammer they end up beating that hammer against every problem they see. Right now it's SQLite. I love SQLite. But man. Can we quit talking about it for one fucking day already? This is probably how it felt to be an Erlang fan when Facebook bought WhatsApp. I remember the decades of Joe Armstrong talking about Erlang on Usenet and no one caring. It's just cargo cult with no thought behind it. WhatsApp was successful using X, so if we use X we must be successful. People have this perception that Python is new and modern despite being, relatively speaking, the same age as Perl. Erlang was cool long before WhatsApp. It's really quite old tech.
Especially with json types in Postgres for example. I can store data that’s suboptimal to use traditional databases to access (think complicated and varying form data) but retrieve it and reference it from table relationships traditionally.
Many of Elixir’s strengths are Erlang’s strengths.
I wouldn’t hesitate to learn some Elixir if it’s interesting to you. It’s not as pervasive as other languages but it’s not niche either.
Full disclosure, it’s been such a wild success for my team at New Relic the last 5 years that I’m very biased :)
There's, as I see it, three different kinds of legacy: (1) code that has an inordinately costs to maintain and especially update to changing requirements because it lacks tests, documentation of existing business intent and/or design, or otherwise has lost institutional knowledge needed for nontrivial work, relying on the foggy memories of a high priesthood increasingly, over time, working through ritual without understanding, (2) software with deep and fundamental dependencies on platforms or external components that are no longer supported or no longer available, and (3) software which doesn't meet the current arbitrary tech platform decisions of the organization using it, but which has no fundamental problem preventing maintenance or use.
In lots of places, software that isn't adapted to a particular serverless architecture that the org has adopted is now the third type of legacy.
> And that cloud providers have solved all the pains that Erlang was supposed to address.
They haven't, though for some use cases, the parts of the stack Erlang would be most useful for implementing are the parts you are likely to just get from a cloud vendor (that's not true of all use cases, though.)
> Elixir sounds very compelling to me, but I worry that I might be going in a direction that's not where the industry is going.
Elixir is probably not the best bet if your concern is to direct the most focussed possible effort learning the things that are most likely to dominate the largest share ofnthr general software dev marketplace in the near future.
These are largely built on top of either a stream processing (in case of Flink) or some flavor of Actor model based on event sourcing for peristence.
What I'm getting at is that you'd build a serverless system on top of Elixir/Erlang/OTP and be served well by its mature actor model implementation and excellent distribution options. See https://eigr.io/ .
The cloud provided options are interesting for some experimental / tactical use cases but I don't yet trust their abstractions to not be leaky and they typically come with vendor lock-in trade offs.
Also:
- the supervisor system in Erlang/Elixir is relatively complex. It goes much beyond the "restart my service" when it crashes but allow to restart some processes, without restarting the service, and in a specific order to keep the system coherent.
- local and remote calls behave the same in Erlang/Elixir, allowing to start with a monorepo having different Erlang "apps" than run on the same node, but then running the different apps on different nodes in the future, once the application, scales. This can be done very little changes to the application.
Some great innovating Elixir projects:
Oban: https://getoban.pro/
Oban Demo: https://getoban.pro/oban
Livebook: https://livebook.dev/
Rails has Hotwire Turbo (which is technically back-end agnostic), Laravel has LiveWire, there's also HTMX which is a bit lower level and back-end agnostic. There's also Django Unicorn and Rails Stimulus Reflex.
All of these solutions let you return HTML back from your server and partially update areas of a page while writing no-to-little JS. They're all implemented differently but for a huge classification of web apps the implementation doesn't matter.
After jumping between Phoenix and Rails for quite some time (years), personally I find Hotwire Turbo's implementation and overall using it extremely intuitive, it "just works". It's been legit one of the best development experiences I've encountered. The best part about it is that it works with any back-end too, so you're not even limited to Rails. DHH and the Rails team never cease to amaze me in what they release to the world.
That anybody claiming serverless has "solved all the pain" is definitely trying to sell me something.
State is suffering, and life is stateful, even after you're long dead and garbage collected.
Also, meta: don't worry too much about where people tell you the industry is heading. 1) They don't actually know, 2) it's much more conservative out there than you might think. Even when new paradigms do gain traction, they pretty much always augment rather than replace, for a good long while at least.
Of other note is that Erlang seems to enable folks that use it to punch above their weight class when it comes to running services internally and such.
Serverless is far from the only valid way to run things these days.
Hardware interaction is more or less non-existent in the world of Serverless.
Timing/Latency is not really controllable. It's at the whim of your provider.
FaaS doesn't support very large systems well. It's far more about scaling down than up.
Erlang is functional for a reason: it minimizes faults. Quality follows.
Complex feature interaction is limited in the stateless serverless world.
Cloud providers tend to solve for a different set of problems, which is fine. But I'm going to claim that many of the things Erlang was designed to solve runs dual to the problems in the cloud space.
Just because the industry is willing to waste money on tech they’ve outgrown doesn’t mean you need to.
Don't know how that'll hold up into the very long term though...
There's a lot of great stuff in the BEAM ecosystem, I would caution on writing it off too fast
I'm glad to hear the community is bigger than what I found. I don't actually remember that search process. What I remember clearest was running into the brick wall of the OTP documentation.
Elixir in Action.
The Little OTP Book.
Designing Elixir Systems with OTP.
Pragmatic Studio's Elixir OTP course.
(Thanks you to Lukas and all others who work on this)
It's complete blindness to the reality. Trusting one single provider for your whole service (often not even completely opensource) is the same trap as Windows or Oracle in the 90's...just worse (because not on prem)...but hey history repeats itself ;)
Assuming this is talking about tools like Kubernetes, they operate on a different level. The OTP's failure tolerance model operates on a (relatively) very small scale inside your application, whereas Kube operates on a whole-application level. Rather than obsoleting OTP, Kubernetes actually complements it.
I have always ignored anything related to Erlang because I dislike the idea of a language that lacks an efficient string representation . . . even though I have spent over a decade using JavaScript! (so maybe I don’t actually care?)
For additional details I recommend https://adoptingerlang.org/docs/development/hard_to_get_righ... which also mentions how unicode is handled. It turned out quite a bit easier because of how Erlang represents strings.
Running millions of concurrent processes, with their own heap, with consistent response times that individually tolerate failure without negatively affecting the entire system is just a different animal with a different set of trade offs.
You’re trading some speed for those benefits.
However, chances are you have an Erlang program, and it's quite large. In this case, the speedup compared to the older bytecode interpreter is good for many programs. It is performance you get "for free" by upgrading.
The underlying reason for picking something like Erlang is robustness. Java isn't really built for this kind of programming, and the JVM doesn't directly facilitate it either.
Erlang JIT takes BEAM bytecode and turns it into native code once at load time in order to avoid the overhead of the threaded code interpreter; if Erlang JIT is enabled, the interpreter is not used at all. Java's HotSpot JIT takes JVM bytecode and turns it into native code at runtime in order to improve performance of code that is run frequently (thus the name), guided by runtime information; lightly used code will be interpreted, heavily used code will hopefully be JITed to native. When HotSpot JITs, it may apply assumptions based on runtime use to produce faster code and if the assumptions don't hold for a call, the interpreter can be used instead (and if that happens often enough, the native code can be discarded and perhaps rebuilt), so the interpreter needs to be present always.
Erlang JIT has been focused more on always applying and speed of application (because it delays code loading), whereas HotSpot focuses more on getting performance gains when it applies, and speed of application is less important because it happens asynchronously. So if you benchmarked speed of applying the JIT, Erlang would probably win, and if you benchmarked optimization of the code, HotSpot would probably win, but either way you're comparing apples and oranges.
https://stressgrid.com/blog/benchmarking_go_vs_node_vs_elixi...
Some of the things I like better about Elixir and Erlang vs. Go and Java are:
- In Elixir/Erlang, all processes are stored in private memory and can only be accessed via defined message interfaces. In both Go and Java, processes are stored in public memory.
- Elixir/Erlang processes are a lot smaller, memory-wise, than Go/Java processes.
- We moved all of our development at my current company from Java to Elixir because Elixir, being functional, makes writing multi-threaded applications a lot faster/easier. Elixir is also cheaper to deploy. At least that has been our experience.
- I like the syntax of both Elixir and Erlang better than Go, Java, or JS.
- I don't have as much experience with Node/Express, but in my limited testing with Node/Express vs. Elixir/Phoenix, the latter is several times faster and much more scalable. It also makes better use of hardware (which I believe is discussed in the link above).
I hope at least some of this helps answer your question.
fyi "1.4 What sort of problems is Erlang not particularly suitable for?"
> New PRNG added to the rand module, for fast pseudo-random numers.
Does this mean mobile apps in Erlang is not far off ?
Could be repurposed for Android development. I don't see it happening soon. Binding to Erlang is pretty difficult, see https://github.com/joshnuss/elixir-ffi.
If it did happen it would be useful, just... take some time.
** Warning: Turns out this is a really bad idea, do not use! When the BEAM calls native functions it needs to know how many reductions should be used. Otherwise calling a long running function can break the scheduling completly, because with this approach a long running function is considered 1 reduction **
Personally, I used ex11 because the wxWidgets interfaces are hard for me to grasp and then accept; it was easier for me to understand X11 as a distributed communication protocol that has a side effect of occasionally outputting graphics; but my application only outputs a bitmap once in a while, so really I could have made anything work. ex11 doesn't help you with mobile though, because Android and iOS don't run X11.
There's also gtkNode, but I don't know how well that works, because it didn't seem any less confusing than wxWidgets. gtk has some ability to run on mobile, I think.
basically wxwidgets comes with a webview, and that one is loaded up - and everything is packaged as an app - so you can use phoenix (liveview), or even react or anything to your liking..
believe certain improvements were made to OTP 25, so multiple things will land soon - even livebook https://github.com/livebook-dev/livebook are aiming at shipping a native app..
The lack of GC also is a problem, so you might have to do each redraw in a fresh process or something like that to avoid accumulating too much memory.
Processes would be good for all sideline functionality like API/db requests and expensive computations.
See: https://github.com/elixir-lang/elixir/releases/tag/v1.13.4
> v1.13.4 (2022-04-07) > This release has been verified to work with Erlang/OTP 25 RC2.
Outlaw Techno Psychobitch FTW