Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Considerations on Java base docker image size #155

Open
necosta opened this issue Mar 26, 2024 · 0 comments
Open

Considerations on Java base docker image size #155

necosta opened this issue Mar 26, 2024 · 0 comments

Comments

@necosta
Copy link

necosta commented Mar 26, 2024

Doing the following steps:

  1. docker pull public.ecr.aws/lambda/java:17
  2. docker run -it --entrypoint=/bin/sh public.ecr.aws/lambda/java:17
  3. cd /; du -sh

We see that this docker image has a size of 495 MB.

From AWS documentation I understand that cold starts are directly related with the size of base Java docker image so doing a further analysis on package sizes (top 10), we get:

rpm -qa --queryformat '%10{size} - %-25{name} \t %{version}\n' | sort -n | tail -10

   3639159 - bash                        4.2.46
   5395175 - dejavu-sans-fonts           2.33
   5815307 - yum                         3.4.3
   6578312 - gnupg2                      2.0.22
  12082753 - glib2                       2.56.1
  13360751 - glibc                       2.26
  14352745 - coreutils                   8.22
  25075705 - libicu                      50.2
  27436806 - python-libs                 2.7.18
 113057424 - glibc-all-langpacks         2.26

As we can see, the library that takes most space is glibc-all-langpacks (107.8 MB, 21.7% of total size)

For the majority (I guess) of lambda programs that work with default locale settings, we could replace this library with glibc-minimal-langpack (which is just a couple of KB's in size).

This would allow faster downloads and faster cold starts (when image not cached).

On https://gallery.ecr.aws/lambda/java , would you consider building an image with minimal langpack? Default image could remain with glibc-all-langpacks.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant