Live data from Hacker News

What I mean when I say that machine learning in Elixir is production-ready

cigrainger.com

91–100 of 108 posts

Re: What I mean when I say that machine learning in Elixir is production-ready

#91
post #68

Earlier quoted context omitted.

> Python doesn't vertically scale very well Strong disagree, this is a skill issue. I have written C++ modules for Python with pybind11 to speed up some code significantly but ended up reverting to pure Python once I learned how to move memory efficiently in Python. Numpy is very good at what it does and if you really have some custom code that needs to go faster you can run it externally through something like pybin…

I said python doesn't scale well and you say "it does if you use an escape hatch to a faster language" Sure. Writing C++ that utilises your resources effectively then writing bindings so you can use that in python is great. But with elixir, if I've got 8 cores and 8 processes, those 8 processes run in parallel. If I want raw cpu speed I can write something in rust, c, cpp or zig and then call it still using elixir se…

I went back and rewrote the systems in Python after learning more about how to manage memory more efficiently using common tools, methods, libraries

Re: What I mean when I say that machine learning in Elixir is production-ready

#92
post #43

Earlier quoted context omitted.

I assume they mean Python doesn't do so by default (nor in a lightweight fashion). You can certainly use all cores with any programming runtime if you just run multiple OS processes. Indeed, that's how you implement multi-core on Ruby and Node as well. Although even then, the cores themselves aren't necessarily being fully utilized, even if you're ostensibly using all cores.

Python 3.13 beta1 can be compiled with no-GIL mode, which allows free-threading that could perhaps use all cores.

Let’s say we do that. How many threads can we create?

On BEAM, running 10,000 lightweight processes is normal. Phoenix is designed so that every incoming http request is its own lightweight process.

How does one manage that number of lightweight processes? The runtime’s scheduler keeps track of every single process so nothing is orphaned. It is preemptive, so no lightweight process can starve out another (though there are some exceptions).

They can also suspend cheaply, as such, works well with async io.

The closest thing to this are the new virtual thread feature of recent Java. I don’t think Java has the same kind of properties that will allow it to manage it as well as BEAM. There is a lot more to Elixir than being able to use all the cores.

Re: What I mean when I say that machine learning in Elixir is production-ready

#93
post #92

Earlier quoted context omitted.

Python 3.13 beta1 can be compiled with no-GIL mode, which allows free-threading that could perhaps use all cores.

Let’s say we do that. How many threads can we create? On BEAM, running 10,000 lightweight processes is normal. Phoenix is designed so that every incoming http request is its own lightweight process. How does one manage that number of lightweight processes? The runtime’s scheduler keeps track of every single process so nothing is orphaned. It is preemptive, so no lightweight process can starve out another (though ther…

Oh certainly; I never meant to think that Python competes with Elixir in this regard. It doesn't.

Re: What I mean when I say that machine learning in Elixir is production-ready

#94
post #33

Earlier quoted context omitted.

> it will scale up on a single machine to make use of all the cores (unlike Nodejs, Python, or Ruby) Python definitely does "use all cores" on a machine with the multiprocessing package, not sure what you mean?

And if you have 4 cores, and 3 of them are blocked by IO, now you only have 1 core to answer requests. What happens if this core also stops in an IO? Your service stops. That can NEVER happen in the Erlang Virtual Machine (the BEAM), because of the preemptive scheduler. This is only one of 100s of examples why the BEAM is the right choice for web systems where real-time can be soft real-time.

Nodejs will also move on if io is blocked.

However, since Nodejs queues bits of execution, rather than messages, errors can get lost. So then you have unhandled promise rejections… and then relying on a linter to look for those times you did not write something to catch the error. I was told this is a good feature of the linter.

Contrast that with the BEAM languages. An unhandled error crashes the lightweight process. Any linked process (such as a supervisor) can decide what to do about the crash (restart, or crash as well). We don’t even need liveliness probe (like in Kubernetes) because the supervisor is immediately informed (push, not pull).

You don’t need a linter to make sure it has a sensible default, because this is handled by design.

Nodejs, on the other hand, is error prone, _by design_, even though it does not block on IO either.

No amount of typespecing is going to fix that.

Re: What I mean when I say that machine learning in Elixir is production-ready

#95

I see so much breathless adoration for Erlang and Elixir, how come it hasn't taken over the world in all this time?

The reality is that it's not nearly as good as the loud proponents would have you believe. Performance isn't great unless you're comparing it to really naive applications written in extremely slow dynamically typed languages like Ruby or Python and OTP and real supervisor trees are not trivial to use correctly. Almost all of the Elixir systems I've seen have serious problems in their supervisor trees. I've also repea…

This. I built my last company on elixir. Deployments of clustered BEAM in cloud VMs are far more complex than load-balancing across node or python servers, not to mention serverless. Any custom genservers we wrote always had stability issues. Type safety was a problem that caused crashes in production. Elixir is a really fun language and BEAM is powerful but it’s by no means a clear choice. My new company is on Next.js and it’s much easier to hire / develop / deploy.

Re: What I mean when I say that machine learning in Elixir is production-ready

#96
Have any of you used elixir-desktop [1]? It is a wxWidgets + LiveView bundle, pretty much like a Electron app.

In [2], Wojtek Mach explains how the team behind Elixir build Livebook Desktop. He explains how the project started, some subtle bugs found when building the app for MacOS, some limitations of wxWidgets in Windows, and many other implementation details.

It would be awesome if the Elixir team release something like elixir-desktop based on Livebook. That is, forking the Livebook repo and release an official template project for generating desktop applications based on LiveView.

[1] https://github.com/elixir-desktop/desktop-example-app

[2] https://www.youtube.com/watch?v=Kiw6eWKcQbg

Re: What I mean when I say that machine learning in Elixir is production-ready

#97
post #96

Have any of you used elixir-desktop [1]? It is a wxWidgets + LiveView bundle, pretty much like a Electron app. In [2], Wojtek Mach explains how the team behind Elixir build Livebook Desktop. He explains how the project started, some subtle bugs found when building the app for MacOS, some limitations of wxWidgets in Windows, and many other implementation details. It would be awesome if the Elixir team release somethin…

Tangential to this, there's also https://native.live/.

Re: What I mean when I say that machine learning in Elixir is production-ready

#98
post #95

Earlier quoted context omitted.

The reality is that it's not nearly as good as the loud proponents would have you believe. Performance isn't great unless you're comparing it to really naive applications written in extremely slow dynamically typed languages like Ruby or Python and OTP and real supervisor trees are not trivial to use correctly. Almost all of the Elixir systems I've seen have serious problems in their supervisor trees. I've also repea…

This. I built my last company on elixir. Deployments of clustered BEAM in cloud VMs are far more complex than load-balancing across node or python servers, not to mention serverless. Any custom genservers we wrote always had stability issues. Type safety was a problem that caused crashes in production. Elixir is a really fun language and BEAM is powerful but it’s by no means a clear choice. My new company is on Next.…

It's funny how this works, I will never work with Next.js ever again (after doing it for years at multiple companies), I find it to be a total mess. Compared to how José Valim and Chris McCord (and others) lead Elixir and Phoenix and Vercel / Meta handles Next.js and React is night and day and I have close to zero trust in the latter. But then again, Next.js a tool to sell Vercel hosting and React has its own roadmap to cater to Meta, both of these are obvious perfectly valid and it's not a secret so people can make their own choices.

I don't know how many times I've done a minor update of Next just to have some undocumented internal change break everything, and reading their release logs are a joke, who thought it would be a good idea to just dump badly written git-commits and call it a day?

As an anecdotal warning, unless your team consists of TypeScript masters with extremely strict ethics you will end up with type safety issues too, they will just be harder to find (and if things go bad crash your runtime or client execution) :) Being easy to hire for has actually been a massive downside personally, it's very hard work finding people who actually know how to build a good React app, not to mention a Next.js ditto, but you'll get an near infinite number of applicants with skills "matching".

Re: What I mean when I say that machine learning in Elixir is production-ready

#99
post #95

Earlier quoted context omitted.

This. I built my last company on elixir. Deployments of clustered BEAM in cloud VMs are far more complex than load-balancing across node or python servers, not to mention serverless. Any custom genservers we wrote always had stability issues. Type safety was a problem that caused crashes in production. Elixir is a really fun language and BEAM is powerful but it’s by no means a clear choice. My new company is on Next.…

It's funny how this works, I will never work with Next.js ever again (after doing it for years at multiple companies), I find it to be a total mess. Compared to how José Valim and Chris McCord (and others) lead Elixir and Phoenix and Vercel / Meta handles Next.js and React is night and day and I have close to zero trust in the latter. But then again, Next.js a tool to sell Vercel hosting and React has its own roadmap…

Jump to Elixir might be a bit too much. You could get strong type safety and scalability with ASP.NET Core without sacrificing productivity you are used to (it's also way faster than BEAM).

Re: What I mean when I say that machine learning in Elixir is production-ready

#100

Earlier quoted context omitted.

We’ve had Elixir in production since 2017 and have not found any of the items you have mentioned to be issues. - two different string types: You have undercounted (three types in Erlang, and Elixir adds a fourth), and suggested that something which is a non-issue for the vast majority of Elixir code. Most Elixir code deals with `String.t()` (`"string"`), which is an Erlang `binary()` type (`"string"` in Elixir, ` >`…

I guess I will just have to stay sour with my sub-second compile times, actual compile-time type checks, stable naming of built-ins, single-binary deployments, and uniform error handling.

Better to say that whatever your resulting platform is (probably Go based on what you’ve said), it suits your constraints.

We've found that our constraints are better met for our most important project by Elixir. We are building something else in Go (mostly because it will be easier to find cheaper contractors to build these boring things once we have the first version done) and we still deliver a number of things in Ruby, and there's Typescript for some things. Use what works at the time you need it.

I personally find Go to be a tedious language and think it could use a fair number of DX improvements, ranging from adopting some form of Rust's terminal `?` sugar to just better recommendations on project structure and layout. It took far too long for Go to get generics, and the platform-specific build files being based on filename (e.g., `foo_aix.go`) is clever with all of the hatred I can put into that.

I have shipped software in ~40 different programming languages and distinct dialects over my career. Go does a number of things well, but some of the choices made are frankly bizarre. There are restrictions on how you can name things because of the platform bit and `internal/`, but then there's no recommendation on how to lay out a project otherwise. I’ll still use it any time over most other lower-level languages, but the language itself does not spark joy. The compiler is good and fast, but I have less confidence that I have built the right thing from it than when I use Rust.

Post reply on HN