neon icon indicating copy to clipboard operation
neon copied to clipboard

Docker image size of the compute node is very large

Open MMeent opened this issue 2 years ago • 1 comments

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

MMeent avatar Aug 26 '22 19:08 MMeent

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.

MMeent avatar Aug 26 '22 21:08 MMeent

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 avatar Oct 01 '22 09:10 hlinnaka

@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.

MMeent avatar Oct 02 '22 12:10 MMeent