Live data from Hacker News

Elixir/Erlang Hot Swapping Code (2016)

kennyballou.com

71–80 of 119 posts

Re: Elixir/Erlang Hot Swapping Code (2016)

#71
Forcing all clients to reload their code at the same time sounds like a bad idea. Allowing different clients to run different incompatible versions of the code at the same time also sounds like a bad idea.

APIs are like database engines; they should rarely change. Making it easy to change them is an anti-pattern.

Engineers don't build bridges with replaceable pillars or skyscrapers with replaceable foundations. When aerospace engineers tried building a plane with replaceable engines, we got Boeing 737 Max...

Re: Elixir/Erlang Hot Swapping Code (2016)

#72
post #39

At kosmi.io we use elixir hot swapping for every small patch/bugfix on the backend. This allows us to deploy updates multiple times a day with 0 disruption. Allows the clients to remain connected and be none the wiser that there was an update at all. For larger updates we just do hard restarts when in-memory data structures or supervision tree are changed.

[deleted]

Re: Elixir/Erlang Hot Swapping Code (2016)

#73
post #32

Earlier quoted context omitted.

They took away our access after one too many outages :yay:

Sounds like what happened with hot upgrade privileges in some erlang shops too.

I've worked at a smaller project where it worked just fine. The key I think is to have the project be small enough to be able to fit in my head.

That and have an identical test server. I used to make changes locally, test it locally, then make the same change on test, have someone else look at it, get a lgtm, and do the same thing on the production machine. It sounds like a lot of steps but it is pretty straightforward.

Sadly, it probably doesn't work with bigger teams or more complicated projects.

Re: Elixir/Erlang Hot Swapping Code (2016)

#75
Live updating a drone running Erlang in 10ms while it was flying with no application restart and no loss of state impressed me when I saw it in 2021:

https://www.youtube.com/watch?v=XQS9SECCp1I

But I almost never hear Erlang/Elixir/Gleam folks talk about this benefit of the Erlang VM now, even though it seems fairly unique and interesting. Has the community moved away from it? Is it just not that useful?

Re: Elixir/Erlang Hot Swapping Code (2016)

#76
post #53

Earlier quoted context omitted.

Came here to say this. In Lisp, you can just compile a function, or load a file and it just works. It's not even sold as a hot feature, not the way Erlang sells it. It's just a feature. I manage a few websites written in Lisp, and updating them is as simple as push code, recompile and it works.

But what if the system is running and the new function takes different arguments or something? What if there is data loaded in the system, what happens to it? Simply loading new code is easy, ensuring the whole system works seems to require a bit more effort.

We do this in q/kdb+ systems often for patches. An important thing about these languages is that this kind of workflow is part of the core for solving problems. So when you are building a system one of the aspects of its design will always allow for this update method. Then when you push a patch you both know the impact of the change (because you've tested the exact same steps in a dev/QA/UAT/Beta environment) and the work required to do it safely.

Major releases do go through a full shutdown and release cycle though.

Re: Elixir/Erlang Hot Swapping Code (2016)

#77

Forcing all clients to reload their code at the same time sounds like a bad idea. Allowing different clients to run different incompatible versions of the code at the same time also sounds like a bad idea. APIs are like database engines; they should rarely change. Making it easy to change them is an anti-pattern. Engineers don't build bridges with replaceable pillars or skyscrapers with replaceable foundations. When…

Engine replacement happens on airplanes fairly frequently. You don't want to scrap an airplane because of a single damaged turbine blade, or even keep it on the ground for longer.

https://jalopnik.com/how-airlines-decide-to-replace-jet-engi....

Re: Elixir/Erlang Hot Swapping Code (2016)

#78

Live updating a drone running Erlang in 10ms while it was flying with no application restart and no loss of state impressed me when I saw it in 2021: https://www.youtube.com/watch?v=XQS9SECCp1I But I almost never hear Erlang/Elixir/Gleam folks talk about this benefit of the Erlang VM now, even though it seems fairly unique and interesting. Has the community moved away from it? Is it just not that useful?

A lot of the GenServer-information floating around explains code_change/3, no? That's commonly what you want, a way to handle state propagation when process code is updating in a running system.

Most people are probably running some web services or something and might as well shift machines in and out of a cluster or can wait for old processes to disband on their own, because the new code is backwards compatible with the one in already running processes, and so on.

It can also be relatively hard to do without causing damage to the system. Those who need and can manage it probably don't need it marketed.

Re: Elixir/Erlang Hot Swapping Code (2016)

#79

Live updating a drone running Erlang in 10ms while it was flying with no application restart and no loss of state impressed me when I saw it in 2021: https://www.youtube.com/watch?v=XQS9SECCp1I But I almost never hear Erlang/Elixir/Gleam folks talk about this benefit of the Erlang VM now, even though it seems fairly unique and interesting. Has the community moved away from it? Is it just not that useful?

A lot of web apps are just well-enough served with a blue-green deployment model. It is less risky.

But if you really need it, it's really great to have that option (e.g. very long running systems which are split in front/back etc), and it can be used in creative ways too (like the Drone example).

Here is a lightning talk I gave about how to use hot-reload for music / MIDI interactions: https://www.youtube.com/watch?v=Z8sGQM6kLvo

Re: Elixir/Erlang Hot Swapping Code (2016)

#80
post #28

Earlier quoted context omitted.

Most of those hot fixes are data driven as in database updates. Gameserver just reload the data, the binary itself is not touch. I've never seen a game where they hot reload code inside the gameserver itself, it's usually a downtime or rolling updates.

LPMUDs ran almost entirely on hot reloadable code written in a quirky language called LPC, which later inspired the Pike language. I believe that only the "driver" code, which handles system calls and hosts the LPC interpreter and is written in C, couldn't be hot reloaded; everything else running in the game could be reloaded without restarting the server. I'd guess in the modern day, there would be some games where…

It's a rather fun language and programming environment, I'd recommend playing around with it over doing AoC.
Post reply on HN