wmnnd

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

josevalim

Creator of Elixir

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

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

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

Where Next?

Popular in Discussions Top

jswny
I would like to better understand what the advantages/disadvantages of umbrella applications are compared to structuring your app as as s...
New
PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
vans163
So useless benchmarks aside, Its possible to write a webserver that can serve 300k requests per second (perhaps more with optimizations)....
New
WildYorkies
It seems that the more I read, the more I find Elixir users speaking about all the ways that Elixir is not good for x, y, and z use cases...
New
tmbb
This is a post to discuss the new Phoenix LiveView functionality. From Chris’s talk, it appears that they generate all HTML on the serve...
342 18122 126
New
PragTob
Hey everyone, this has been on my mind for some time and I’d love your input on it! TLDR: I feel like maps are superioer for storing and...
New
AstonJ
If a newbie asked you about Phoenix Contexts, how would you explain the basics to them? Feel free to be as concise or in-depth as you li...
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
acrolink
How does the two languages compare when it comes to server side application development? Any experiences or ideas? Thank you.
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42842 311
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30840 112
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement