1、Optimizing Java Applications on KubernetesBeyond the BasicsBruno BorgesMicrosoft Developer DivisionJava Engineering Group(JEG),June 2024DevDiv Java Engineering GroupAgenda Part II:Kubernetes Vertical Autoscaling Java on Kubernetes Understanding CPU Throttling Impact of resource distribution on perfo
2、rmance and cost Part III:AB Perf Test Performance Testing different topologies Part 0:Size and Startup time Container images JVM startup optimizations Part I:JVM Defaults Default Ergonomics Understand JVM default values How memory and CPU impact GC selection Garbage Collectors Recommendations for be
3、tter starting points for dedicated environmentsNon-goal:Advanced JVM TuningWe dont cover JVM Tuning here,but you can see the opportunities!Part 0:Size and Startup timeSize is nice,security is better:reducing attack surface area.DevDiv Java Engineering GroupWhy reduce container images?Size is importa
4、nt,but Storage is cheap Network speed between VM and Container Registry is super fast if container image size is impacting scaling,then make it a priority Security is truly important,and Less 3rd-party dependencies reduces potential vulnerabilities that can be exploited Reduces attacking surface are
5、a by eliminating unnecessary tools Easier to meet compliance requirements Easier to audit Lower risk of misconfiguration Faster to update and patchDevDiv Java Engineering GroupHow to reduce container image size?Base Image OS layer Use distroless images Java application Reduce dependencies at runtime
6、 Layer dependencies and app binary separately Run with a non-root user JVM runtime Create a custom Java runtime with just the parts you need Go the extra mile with GraalVM Native ImageDevDiv Java Engineering GroupBase imagesImageTypeSize(extracted)DebianFull117 MBUbuntuFull 78.1 MBDebianSlim74.8 MBA