Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use glibc version in ruby_platform cache header if available
Previously, the `ruby_platform` header in the cache was calculated as a hash of the `RUBY_PLATFORM` (e.g. x86_64-linux-gnu) with the `uname -v` output (e.g. `#75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019`). However, using `uname -v` is a bit restrictive on Linux systems. It makes it difficult for a containerized application to bundle the Bootsnap cache with the application itself. For example, in Docker, the host operating system determines the kernel version, so even though a Docker image may be built with a specific base image, the output of `uname -v` will change depending on where it's run. As a result, the application will need to rebuild the Bootsnap cache every time unless a persistent volume is used AND the kernel version is fixed. However, both requirements can be difficult to guarantee, which negates any speed-up that Bootsnap provides. We observe that in a Linux system, the application binary interface (ABI) is defined by the kernel version and glibc version. A change in the kernel ABI requires a change to glibc. Instead of hashing the output of `uname -v`, we hash the glibc version if it is defined by the compiler.
- Loading branch information