JVM Multitenancy

1. Issues

  • Slow startup
  • Memory consumption(COW?)

2. Multitenancy allow to host multiple apps in one JVM With respect to

  • Isolation
  • Density(Less memory cosumption)

3. Possible solution - Multitenant JVM.

  • Isolation due to isolated classloaders
  • Density due to shared JITed code, shared static final vars, permgen
  • Faster startup - hot cache and jit, already loaded .so

4, NO changes required

  • just: java -Xmt -jar one.jar
  • Yep, on first run JVM is started as daemon, next runs will use running daemon

5. Resource limits

  • -Xlimit:cpu=10-30 (10 percent minimum CPU, 30 percent maximum)
  • -Xlimit:cpu=30 (30 percent maximum CPU)
  • -Xlimit:netIO=20M (maximum bandwidth of 20 Mbps)
  • -Xms8m-Xmx64m (initial 8 MB heap, 64 MB maximum)

6. Benefits w/ numbers

  • 2 x higher number of tenants that classic JVM(jetty usecase)
  • up to 6x lower startup time(jetty usecase)

7. Issues

  • No, Native libraries(JNI/JNA) are NOT isolated - including SWT
  • Instrumentation calls(JVMTI - aka java debugger) - are not isolated

8. See

  • Slideshare: http://tinyurl.com/jvm-multitenancy
  • This slides: http://altio.us/jvm-multitenancy

9. Recap

  • JVM Multitenancy allow to host multiple apps in one physical JVM
    • Faster startup
    • Less memory footprint
  • Enabled simply, just add -Xmt
  • Will be available in Java8, yes, for free & no strings attached