openj9 icon indicating copy to clipboard operation
openj9 copied to clipboard

Implement initial RAM class persistence feature

Open ThanHenderson opened this issue 4 months ago • 1 comments

This PR revives RAM class persistence work. It currently rebases/implements: https://github.ibm.com/runtimes/openj9-stratum/pull/7 and https://github.ibm.com/runtimes/openj9-stratum/pull/25.

Current considerations/limitations:

  • No JIT support (i.e. -Xint required)
  • Incompatible with SCC (i.e. -Xshareclasses:none required)
  • ASLR must be turned off (I've been using echo 0 | sudo tee /proc/sys/kernel/randomize_va_space to turn this off)
  • Build must be configured with --enable-snapshots (requires extension repo patches)
  • Only creates snapshot on VM exit. Further support for triggering points during execution is underway.
  • No functionality to auto-detect whether a specified cache is compatible with the current invocation. (i.e. if you specify ramCache as the cache name for one program, then again for a different program, it will try to reuse the created cache rather than recognizing that it is incompatible and emitting a warning or deleting it and creating a new one).
  • Development only for JDK8, need to reassess to see what is required for later versions.

Example:

# Ensure ASLR is disabled (echo 2 to reset to default)
echo 0 | sudo tee /proc/sys/kernel/randomize_va_space

# Run the java program, creating a cache called "ramCache" that persists RAM class data
java -Xint -Xshareclasses:none -Xsnapshot=ramCache <java-program>

# Run the same java program, loading the persisted RAM class data from an image called "ramCache"
java -Xint -Xshareclasses:none -Xsnapshot=ramCache <java-program>

Signed-off-by: Nathan Henderson [email protected]

ThanHenderson avatar Oct 18 '24 21:10 ThanHenderson