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

Bazel's embedded JDK is minimized #6314

Closed
meisterT opened this issue Oct 5, 2018 · 3 comments
Closed

Bazel's embedded JDK is minimized #6314

meisterT opened this issue Oct 5, 2018 · 3 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) team-Performance Issues for Performance teams

Comments

@meisterT
Copy link
Member

meisterT commented Oct 5, 2018

Restrict the set of modules in the embedded JDK to what Bazel needs, probably:
java.base, java.compiler, java.logging, java.management, jdk.management, jdk.unsupported, jdk.compiler, jdk.net, jdk.zipfs

Part of https://docs.google.com/document/d/1Igmv-2GfXkoVFWTXvBYPeniQom8nLAwzqzridDlBIS4/edit?ts=5babff11#heading=h.nke12cugvesd

Will reduce final binary size by ~40MB

@meisterT meisterT changed the title Bazel Bazel's embedded JDK is minimized Oct 5, 2018
@meisterT meisterT added this to the shrinking the bazel binary milestone Oct 5, 2018
@meisterT
Copy link
Member Author

meisterT commented Oct 5, 2018

(blocked by #6313)

@jin jin added team-Performance Issues for Performance teams untriaged labels Oct 6, 2018
@meisterT meisterT added P1 I'll work on this now. (Assignee required) and removed untriaged labels Nov 29, 2018
bazel-io pushed a commit that referenced this issue Dec 3, 2018
Steps:
curl https://mirror.bazel.build/openjdk/azul-zulu-9.0.7.1-jdk9.0.7/zulu9.0.7.1-jdk9.0.7-linux_x64.tar.gz -o zulu9.0.7.1-jdk9.0.7-linux_x64.tar.gz
tar xf zulu9.0.7.1-jdk9.0.7-linux_x64.tar.gz
cd zulu9.0.7.1-jdk9.0.7-linux_x64
./bin/jlink --module-path ./jmods/ --add-modules java.base,java.logging,java.management,jdk.management,jdk.unsupported,jdk.net,jdk.zipfs,java.xml --vm=server --strip-debug --no-man-pages --output zulu9.0.7.1-jdk9.0.7-linux_x64-minimal
cp DISCLAIMER readme.txt zulu9.0.7.1-jdk9.0.7-linux_x64-minimal
GZIP=-9 tar -zcf ../zulu9.0.7.1-jdk9.0.7-linux_x64-minimal.tar.gz zulu9.0.7.1-jdk9.0.7-linux_x64-minimal

Closes #6819.

Progress towards #6314.

PiperOrigin-RevId: 223785707
bazel-io pushed a commit that referenced this issue Dec 5, 2018
It's critical for Bazel's binary size that we don't increase the list of
modules.
We will also use the same list in a later commit build a reduced JDK.

Closes #6846.
Progress on #6314.

PiperOrigin-RevId: 224140271
meisterT added a commit to meisterT/bazel that referenced this issue Dec 17, 2018
This refactoring is necessary to test with the minified version of
bazel, see bazelbuild#6314.

RELNOTES: None
bazel-io pushed a commit that referenced this issue Dec 17, 2018
This refactoring is necessary to test with the minified version of
bazel, see #6314.

RELNOTES: None

Closes #6944.

PiperOrigin-RevId: 225825275
bazel-io pushed a commit that referenced this issue Dec 18, 2018
Progress towards #6314.

RELNOTES: None

Closes #6956.

PiperOrigin-RevId: 226026209
@meisterT meisterT assigned meisterT and unassigned buchgr Dec 19, 2018
meisterT added a commit to meisterT/continuous-integration that referenced this issue Dec 19, 2018
philwo pushed a commit to bazelbuild/continuous-integration that referenced this issue Dec 20, 2018
bazel-io pushed a commit that referenced this issue Dec 20, 2018
Progress towards #6314

RELNOTES: None
PiperOrigin-RevId: 226317159
bazel-io pushed a commit that referenced this issue Dec 20, 2018
One more step of #6314

RELNOTES: None
PiperOrigin-RevId: 226320059
bazel-io pushed a commit that referenced this issue Jan 8, 2019
This will save ~22MB of the final bazel binary and ~120MB in the
install_base.

RELNOTES[INC]: //src:bazel uses the minimal embedded JDK, if you want to
avoid the extra steps of minimizing the JDK, use //src:bazel-dev
instead.

Closes #7049, part of #6314.

PiperOrigin-RevId: 228299644
meisterT added a commit to meisterT/bazel that referenced this issue Jan 18, 2019
This builds the minimal JDK locally and uses it as embedded JDK.
We typically use the cached one on mirror.bazel.build, because the jlink
is heavily non-determistic. However, this will make local testing
easier, e.g. when we do upgrades from one JDK to another.

Progress on bazelbuild#6592 and bazelbuild#6314.

RELNOTES: None
laszlocsomor pushed a commit to laszlocsomor/bazel that referenced this issue Jan 18, 2019
This builds the minimal JDK locally and uses it as embedded JDK.
We typically use the cached one on mirror.bazel.build, because the jlink
is heavily non-determistic. However, this will make local testing
easier, e.g. when we do upgrades from one JDK to another.

Progress on bazelbuild#6592 and bazelbuild#6314.

RELNOTES: None

Closes bazelbuild#7175.

PiperOrigin-RevId: 229912262
meisterT added a commit to meisterT/bazel that referenced this issue Jan 29, 2019
With this we can also build the allmodules JDK in the buildkite
pipeline.

This is a necessary step for the upgrade to JDK 11, see bazelbuild#6592 and bazelbuild#6314.

RELNOTES: None
meisterT added a commit to meisterT/bazel that referenced this issue Jan 29, 2019
With this we can also build the allmodules JDK in the buildkite
pipeline.

This is a necessary step for the upgrade to JDK 11, see bazelbuild#6592 and bazelbuild#6314.

RELNOTES: None
bazel-io pushed a commit that referenced this issue Jan 29, 2019
With this we can also build the allmodules JDK in the buildkite
pipeline.

This is a necessary step for the upgrade to JDK 11, see #6592 and #6314.

RELNOTES: None

Closes #7287.

PiperOrigin-RevId: 231398365
weixiao-huang pushed a commit to weixiao-huang/bazel that referenced this issue Jan 31, 2019
This builds the minimal JDK locally and uses it as embedded JDK.
We typically use the cached one on mirror.bazel.build, because the jlink
is heavily non-determistic. However, this will make local testing
easier, e.g. when we do upgrades from one JDK to another.

Progress on bazelbuild#6592 and bazelbuild#6314.

RELNOTES: None

Closes bazelbuild#7175.

PiperOrigin-RevId: 229912262
weixiao-huang pushed a commit to weixiao-huang/bazel that referenced this issue Jan 31, 2019
With this we can also build the allmodules JDK in the buildkite
pipeline.

This is a necessary step for the upgrade to JDK 11, see bazelbuild#6592 and bazelbuild#6314.

RELNOTES: None

Closes bazelbuild#7287.

PiperOrigin-RevId: 231398365
bazel-io pushed a commit that referenced this issue Feb 2, 2019
Windows doesn't use any sandbox, so if you build both the minimized and
the allmodules JDK from the vanilla JDK temporary files clashed in the
past.

This will create a unique subdirectory and also clean up after
themselves.

See #6314.

RELNOTES: None

Closes #7332.

PiperOrigin-RevId: 232117387
meisterT added a commit that referenced this issue Feb 21, 2019
This saves ~5MB on linux (probably the same on other platforms as well).

Progress on #6314.

RELNOTES: None
bazel-io pushed a commit that referenced this issue Feb 21, 2019
This saves ~5MB on every platform, new sizes:
104MB on Linux
107MB on Mac
98MB on Windows

#7492 will probably land before this and reduce size by another ~10MB, so we should be below 100MB on every platform!

Progress on #6314.

RELNOTES: None

Closes #7494.

PiperOrigin-RevId: 235010390
@meisterT
Copy link
Member Author

This is the current list and sizes of the modules that we include:

22Ki jdk.unsupported.desktop
25Ki jdk.unsupported
42Ki jdk.management.jfr
45Ki java.instrument
69Ki jdk.management
82Ki java.sql
92Ki jdk.sctp
95Ki java.management.rmi
95Ki jdk.management.agent
117Ki java.compiler
124Ki java.logging
214Ki java.sql.rowset
443Ki java.naming
579Ki java.security.jgss
665Ki java.xml.crypto
870Ki java.management
4.9Mi java.xml
6.4Mi jdk.compiler
13Mi java.desktop
20Mi java.base

bazel-io pushed a commit that referenced this issue Apr 18, 2019
Since we remove the jdk.compiler module in
3880ddc, this is no longer included
anyway. Deleting it here breaks building the minimal jdk, which we need
to do for the java.desktop removal.

Commit 2/N

This is part of #7502 and #6314.

RELNOTES: None

Closes #8086.

PiperOrigin-RevId: 244156777
bazel-io pushed a commit that referenced this issue Apr 18, 2019
Disabling the jdeps test while doing so to get rid of the chicken-egg
problem that the necessary changes have to happen in third_party but
this test definition lives outside of third_party.

Commit 1/N

This is part of #7502 and #6314.

RELNOTES: None

Closes #8085.

PiperOrigin-RevId: 244156842
meisterT added a commit to meisterT/bazel that referenced this issue Apr 23, 2019
bazel-io pushed a commit that referenced this issue Apr 23, 2019
?ee3bae46eccf596b3b1ffce63c84ce81b.

Commit 4/4

Fix #7502, partly address #6314.

Brings down bazel's binary size to 50MB on linux.

Closes #8116.

PiperOrigin-RevId: 244839623
joeleba pushed a commit to joeleba/continuous-integration that referenced this issue Jun 17, 2019
@meisterT
Copy link
Member Author

I don't currently have further plans to work on this, so I am closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-Performance Issues for Performance teams
Projects
None yet
Development

No branches or pull requests

3 participants