RFR: 8309191: Reduce JDK dependencies of cgroup support
Aleksandar Pejović
duke at openjdk.org
Wed May 31 22:02:31 UTC 2023
The current code for cgroup support in the JDK has large and expensive dependencies: it uses NIO, streams, and regular expressions. This leads to unnecessary class loading and slows down startup, especially when the code is executed early during an application startup. This is especially a problem for GraalVM, which executes this code during VM startup.
This PR reduces the dependencies:
- NIO is replaced with regular `java.io` for file access.
- Streams are replaced with loops (a side effect of this is that files are read in full whereas previously they could be read up to a certain point, e.g., until a match is found).
- Regular expressions are replaced with manual tokenization (and for usages of `String.split`, the "regex" is changed to single characters for which `String.split` has a fast-path implementation that avoids the regular expression engine).
-------------
Commit messages:
- Merge branch 'master' into ap/cgroup-tweaks
- Use simple loops to process cgroup files
- Use java.io for reading cgroup files
- Reimplement mountinfo parsing without using regex
- Use simple patterns to parse cgroup files
- Factor out logging from CgroupSubsystemFactory.create
Changes: https://git.openjdk.org/jdk/pull/14216/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14216&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8309191
Stats: 163 lines in 6 files changed: 73 ins; 55 del; 35 mod
Patch: https://git.openjdk.org/jdk/pull/14216.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14216/head:pull/14216
PR: https://git.openjdk.org/jdk/pull/14216
More information about the core-libs-dev
mailing list