wmnnd
Elixir Static App Binaries
The Go vs Elixir thread got me thinking: Would it be too hard to implement a simple mechanism for creating Go-style static app binaries from Distillery Releases?
After all, Releases already bundle all Elixir/Erlang dependencies, so they seem like an ideal starting point.
I suppose, one could come up with an elaborate solution that would implement a custom boot process for the BEAM VM and somehow load all required BEAM files into it.
But why not create a “dumb” binary that is bundled with the release data (think self-extracting archive). It could dump its contents into a temporary folder and runs the app from there. A slightly more elaborate approach would be to use a user-space filesystem (FUSE on Linux) like AppImage does.
Combined with adequate compression, this could produce binaries of around 10 MB.
What do you think?
Most Liked
josevalim
Folks, stop expecting that @joeerl and I will come up with the solutions to everything. If it is a problem in the community, the community should get together and solve it.
While we can’t provide the same as Go/Rust, since we don’t compile to native code, we can probably get pretty close, even if it is a self-extractable release.
Also, last time I checked Nerves is able to cross compile the whole OS, NIFs and applications into 20MB. Go look there.
Java also has the same limitations as us and a quick search shows that solutions are available.
mischov
This seems like an appropriate time to post this, from a recent comment on HN:
We [at Discord] have one (very low throughput) service that runs Elixir inside of a docker container, however, the rest just run BEAM on the VM directly, with no containerization. BEAM at higher load does not enjoy sharing cores with anyone. Most of our Elixir services sit at 80-100% of CPU on all cores. BEAM likes to spin for work, and is CPU topology aware. Two BEAM scheduler threads running on the same core is a recipe for disaster. Since we’re fully utilizing our VMs, and shipping the tars is simple enough, Docker gave us too much operational overhead for it to be worth it.
cdegroot
18:15:08 cees@cees-MBP-Linux:~/tmp/foo$ mix escript.build
Generated escript foo with MIX_ENV=dev
18:15:12 cees@cees-MBP-Linux:~/tmp/foo$ time ./foo
hello, world
real 0m0.179s
user 0m0.166s
sys 0m0.056s







