Hacker News new | ask | show | jobs
by rdtsc 3173 days ago
Hotswapping just like security is one of those things that is hard to bolt on later, unless it is built in deeply into the very core of the language / runtime.

Erlang (and Elixir) define hotswapping very well. It is a standard way to upgrade code in production in some places. And even with it being well defined it is still very hard and there are enough corner cases to handle.

But when used correctly, it is really magical and can achieve nice properties.

Besides just upgrading code, hotswapping (at least in Erlang) can be used for debugging -- you can update the running code with extra log statements to catch sneaky corner cases. Maybe it is a customer setup, that is very hard to replicate.

Or you can use it for local development, as you edit code, the module gets auto-reloaded (with a helper).

It can also be used to deliver hot fixes. Say if the fix is simple and the customer cannot wait for a full release to be built, can update their system on the spot to tie them over. Not idea but I've seen it save the day many times.

2 comments

Or you can use it for local development, as you edit code

This is a huge feature for me in my Elixir development. I mostly use Elixir for some server code that manages many connections to external network entities. It would be a huge hassle to bring down my server application every time I want to make a change.

With Elixir (yeah, Erlang), I can normally recompile the module I'm working on and deploy it in the running server. Not only is it a good way to constantly observe Erlang hot-swapping in action on my dev machine, it's a huge time saver.

Couldn't agree more, when the article said "Starting and tearing down millions of heavy processes a day would create undue churn on other infrastructure" I just thought, yes, I best you'd struggle to create an architecture so monolithic in Erlang or Elixir. Just one of the many benefits of course... add on the the number of process you can create on one machine while maintaining throughput...