neon
neon copied to clipboard
Docker image size of the compute node is very large
Steps to reproduce
Check size of docker image neondatabase/compute-node:latest
Expected result
A value much less than 500 MB
Actual result
500+ MB
Environment
Any
Initial work in #2346 has shrunk the image by about 220MB from 521.83 MB to 303.26 MB, which is quite nice. Functionality has not been validated yet.
We could potentially further reduce that that by slimming down extensions, but right now this seems like a great start.
Stripping the useless .debug_pubnames and .debug_pubtypes sections from the rust binaries would help a little, see https://github.com/neondatabase/neon/pull/2514. That PR doesn't change the docker build, but we could add a similar step in there.
$ ls -lh target/release/compute_ctl
-rwxr-xr-x 2 heikki heikki 114M Sep 30 22:52 target/release/compute_ctl
$ objcopy -R .debug_pubnames -R .debug_pubtypes -p target/release/compute_ctl
$ ls -lh target/release/compute_ctl
-rwxr-xr-x 2 heikki heikki 88M Sep 30 22:52 target/release/compute_ctl
@hlinnaka could you check it with --profile release-line-debug-size-lto
(which we use in production docker image builds)?
That decreased the size of the binary to < 22 MB (see https://github.com/neondatabase/neon/pull/2346#issuecomment-1234183553 for further description), and I don't know whether that profile includes those debug_pubtypes sections.