1、richardstartinA walk along the performance-complexity curveRichard Startin1richardstartinWhat is the performance-complexity curve?A model of the relationship between performance*and complexity as we optimise code proposed by Aleksey Shipilv.*substitute whichever of latency,throughput,cost you care a
2、bout for performance2richardstartin3richardstartin4richardstartin5richardstartin6richardstartin7richardstartinRichard StartinSenior Software EngineerWorking on Continuous Profiling for JavarichardstartinGreen Zone9richardstartinDecide on an objectiveKnow what you want to achieve:Reduce latency?Incre
3、ase throughput?Reduce cost?10richardstartinFinding CPU bottlenecksMetrics better place to start than profilesAnalyse profiles once you know there is a CPU problem11richardstartinContinuous ProfilingContinuously sample the JVM in production at low overheadRecord profiles for all JVMs in a fleet,aggre
4、gate across instancesDifferent technical approaches exist:JFR(built in to JVM)Async-profiler(JVMTI agent,runs in-process)Perf(out of process user-space Linux profiler with kernel support)eBPF(runs in kernel)12richardstartinContinuous ProfilingJFR(in-process)Doesnt take execution samples with true CP
5、U sampling strategy,doesnt report errorsHas privileged access to JVM internals-provides very useful trace eventsGood allocation profilerAsync-profiler(in-process)Various accurate CPU sampling strategiesRigorous error reportingVarious JVMTI based tracing implementations:allocations,locksCan unwind na
6、tive stacksNo other in-process JVM profiler overhead low enough for production useDatadog continuous profiler uses and extends JFR and async-profiler13richardstartinKinds of low hanging fruitNon-functional bugs14richardstartinApache Helix/Pinot busy spin15richardstartinApache Helix/Pinot busy spinhj