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

Image size for production use #357

Open
faandg opened this issue Aug 21, 2020 · 7 comments
Open

Image size for production use #357

faandg opened this issue Aug 21, 2020 · 7 comments
Assignees

Comments

@faandg
Copy link

faandg commented Aug 21, 2020

Hi,

We are using 20.0.0.7-kernel-java8-openj9-ubi to build container images.
Using the image means adding an application, installing features and adding some configuration.
Our production containers are around ~850MB in size which is quite large for an image.

Using dive we looked at the breakdown of such an image:

image

We were wondering if any of these components can be stripped of unnecessary parts?
Doing this ourselves would probably mean forfeiting support?

Best regards.

@arthurdm
Copy link
Contributor

Thanks @faandg - this is a great topic, and having a visualization of your data really helps.

The UBI 8 Standard (OS) and AdoptOpenJDK 8 (Java) layers are as expected. There is a small footprint OS that we have used in the past (UBI 8 min), which last I checked reduced the image by about 120 MB - but, it came with the price that not all of the tools needed for proper production serviceability were there, and you had to use microdnf instead of yum. That is always something that can be discussed though.

Can you drill down into your output? I wonder if the 137 MB is coming from the class cache. Did you run configure.sh in your application Dockerfile?

I am also curious about your application being 90 MB - is that accurate?

cc @NottyCode @vijaysun-omr

@faandg
Copy link
Author

faandg commented Aug 24, 2020

Hi @arthurdm, you are correct in assuming the output folder contains mostly class cache:

image

Yes, we use configure.sh in our Dockerfile and we see the application server restarting several times to build up the SCC.
We know we can disable it using ARG OPENJ9_SCC=false but in this case we prefer using it to reduce the overall memory footprint.

Concerning the application - it is the first of 60 applications we are moving from WebSphere ND to Liberty on OCP and it is not quite split into microservices yet :)
It is an EAR with several components and libraries. The size you are seeing is the packaged EAR and the expanded libs:

image
We know we can still further reduce this but it's still a work in progress.

We found the kernel-ubi-min image during our first searches among the WebSphere Liberty tags and we did have some interest in using them. When you say "it came with the price that not all of the tools needed for proper production serviceability were there", could you elaborate which tools were missing and/or which task for serviceability wouldn't be available?

@arthurdm
Copy link
Contributor

Hey @faandg - sorry for the delay. For UBI 7 (which we were using at the time), the minimal image didn't even have things like ps. But some things changed in UBI 8, and we have been getting a lot of requests for a smaller images, so a min tag is possible.

If we were to support a UBI 8 min image, what Java layer would you be interested in? I am thinking about AdoptOpenJDK 11 + OpenJ9.

@faandg
Copy link
Author

faandg commented Sep 11, 2020

No problem @arthurdm.
We would be interested in both AdoptOpenJDK 8 + OpenJ9 and AdoptOpenJDK 11 + OpenJ9.
Preferably this ubi-min image would have the Liberty kernel layer since we care about the size of the image.

Most of our large enterprise customers have not been using JDK11 yet, some only partially migrated/tested or only for new development projects.
Some simply say they have no reason to change, until they do :)

@arthurdm
Copy link
Contributor

let's consider this one Leo - for both OL and WL.

@LDL-GH
Copy link

LDL-GH commented May 28, 2021

Is there any news about this?
I'm very interested in every possibility to shrink the image size.

@leochr
Copy link
Member

leochr commented Jun 1, 2021

@LDL-GH Adding ubi-min based images is in our roadmap. We completed the initial investigation and planning to start the work soon.

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

4 participants