Problem Description
I am experiencing significant boot time issues with an Erlang release and would appreciate guidance on optimization approaches. My release exhibits boot times between 5-10 seconds, which appears excessive given its relatively small size. This issue mirrors the problem documented in this Elixir forum thread.
Environment Details
Erlang Version: Currently using Erlang 27
, though this issue has been consistently observed across previous versions including Erlang 26
and even 28
.
Deployment Environment: Release deployed within Docker containers.
Release Characteristics
The release contains a modest number of compiled modules:
# Total modules including OTP components
~$ find _build/prod/rel/mirakle/lib -type f -name "*.beam" | wc -l
804
# Application-specific modules including deps (cowboy, etc.) and excluding OTP (kernel, inets, etc.)
~$ find _build/prod/rel/mirakle/lib -type f -name "*.beam" | wc -l
338
# Application-specific modules only (excluding both deps and OTP)
~$ find _build/prod/rel/mirakle/lib -type f -name "*.beam" | wc -l
56
Current Configuration and Attempted Solutions
I have switched from embedded
to interactive
mode in an attempt to address this performance issue. While interactive mode successfully reduced memory consumption, the boot time remains approximately 5 seconds, which represents only a marginal improvement from the original 5-10 second range.
Request for Assistance
What additional strategies are available for optimizing Erlang release boot time? The persistence of this issue across multiple Erlang versions suggests that the problem may be related to fundamental configuration parameters, build optimizations, or architectural considerations rather than version-specific bugs.
I am particularly interested in understanding whether there are specific techniques for reducing module loading overhead, optimizing the boot sequence, or leveraging Docker-specific optimizations that could address this performance bottleneck.
Any insights, recommendations, or diagnostic approaches would be greatly appreciated.
For additional context, our infrastructure includes other Docker images written in Rust that boot instantaneously. However, these services must wait for the Erlang Docker image to complete its boot sequence since the primary application logic resides in Erlang. The current boot delay of nearly 10 seconds has become a significant operational burden for our customers during each deployment cycle, particularly as we do not utilize release upgrades and instead deploy fresh containers.
Best regards,
Z.