Java企业应用性能优化分析

上传人:I*** 文档编号:156357990 上传时间:2020-12-17 格式:PPTX 页数:25 大小:714.83KB
返回 下载 相关 举报
Java企业应用性能优化分析_第1页
第1页 / 共25页
Java企业应用性能优化分析_第2页
第2页 / 共25页
Java企业应用性能优化分析_第3页
第3页 / 共25页
Java企业应用性能优化分析_第4页
第4页 / 共25页
Java企业应用性能优化分析_第5页
第5页 / 共25页
点击查看更多>>
资源描述

《Java企业应用性能优化分析》由会员分享,可在线阅读,更多相关《Java企业应用性能优化分析(25页珍藏版)》请在金锄头文库上搜索。

1、Java企业应用性能优化分析原则, 方法与策略,技术创新,变革未来,Outline,Performance Basics and Methodology Fundamentals of Performance Tuning Profiling Driven Optimization JVM Tuning GC JIT Optimization Strategy for JavaEE Recap,Recall Littles law,L = *W,In queueing theory,the long-term average number of customersin a stable sys

2、tem, L,is equal to the long-term average arrival rate, multiplied by the average time a customerspends in the system, W source: https:/en.wikipedia.org/wiki/Little%27s_law,Throughput and RT,MeanNumberInSystem = MeanThroughput* MeanResponseTime Throughput and RT are related Decreasing RT ”almost alwa

3、ys” improves Throughput Throughput improving doesnt necessarily mean RT decreasing Performance tuning and cost saving More higher throughput/lower RT but without adding new hardware source: https:/en.wikipedia.org/wiki/Little%27s_law,Approaches to Performance,Hardware,Operating System,Java VM,AppSer

4、ver,Algorithm optimization Profiling-driven,App,Upgrade (JDK&OS) JVM(OS) Tuning Specialization,Use new hardware Use cheaper hardware,Javas view Approaches: Outside in approach(performance baseline) Layered approach(“Bottom up” or “Top down”) A hybrid of both a), b),Amdahls Scaling Law,Speedup =,1,1,

5、+,F: is fraction of work that is serial N:is number of threads source: https:/en.wikipedia.org/wiki/Amdahl%27s_law Reduce the amount of serial work performed,Costs Reduce Scaling,Potential contributors to F: Synchronization(synchronized&j.u.c.Lock),data structures need to be thread safe communicatio

6、n overhead between threads,Infamous “stop the world” (aka STW) in JVM Cost incurred when the N gets increased Thread context switch,JConsole (MXBean) Java Mission Control JProfiler HealthCenter&jucProfiler,Profiling: Sampling vs Instrument,foo main,bar,sampling,Instrument,bar foo main Available Tech

7、nology: BCI, JVMTi, javax.management, System.currentTimeMillis(),method call bar foo main,Sampling vs Instrument,Sampling Lower overhead (determined by sampling interval) Discover unknown code Non intrusive No execution path Periodicity Bias Instrument Wall time (estimate IO time) Full execution pat

8、h Configuration on what methods to instrument Generally more data to be collected,Safepoint Bias,Stack trace sampling happens only when the given thread at a safepoint The hot loop may not get profiled anymore Use following tools instead Java Mission Control Honest Profiler(githup) ZProfiler(alipay

9、internal profiling tool),Tools for Diagnostics,Most of them could be found in JAVA_HOEM/bin Good reference: Troubleshooting Guide for JavaSE 6 with HotSpotVM,Basics of JVM Tuning,Guild for GC Tuning,Select the right GC algorithm parallel old ,CMS and G1 collector Rule of thumb: GC overhead is ideall

10、y 10% Choose the right heap size,source: Charlie Hunt, Binu John JavaTM performance Configure the appropriate GG parameters,JIT and common optimization,Monomorphic dispatch ,Important concepts Profiler guided optimization(PGO) Optimization decisions are made dynamically Mix mode execution Somecommon

11、 optimization Inlining Intrinsic Liskov substitution principle,Subtypes MUST be substitutable for their base types,JIT Profiling with JITWatch,JITWatch: a graphical visualization and analysis tool for understanding the JIT,Enabled by: -XX:+UnlockDiagnosticVMOptions -XX:+TraceClassLoading -XX:+LogCom

12、pilation -XX:+PrintAssembly,Typical distributed JEE architecture,Java EE Container,Java EE Application,REST Service via HTTP,DB via JDBC,Remote Bean via RMI,System A cloud,System B cloud,System C cloud,The problem Add communicationcost RPC serialization/deserialization Can not shift resources toward

13、s demand Can not share the underlying Java artifacts(such as JIT),Multitenancy for JavaEE,Operating System,Java VM,AppServer,App,Hardware,Operating System,Java VM,App1 App2App3 AppServer,Appx,Hardware,Run multiple Java EE applications (as tenants) into same Java EE container,High Density Cloud for J

14、avaEE,The JavaEE applications developed separately can be deployed seamlessly into the same container. devOps Orchestrate JavaEE application at scale Infrastructure,Multi-tenant JavaEE container VirtualizedJVM,source: ,Tomcat/JDK extended for PaaS,Hardware,AliTomcat(Multi-tenant) AJDK(Virtualized),O

15、S,AliTomcat: run multiple apps side-by-side safely,AJDK allows for collocation of multiple JEE apps(as tenant) in a single instance of JVM:,Isolate application from one another. Share metadata aggressively and transparently, such as:,bytecodes of methods GC JIT,: Alibaba/Alipay JDK, based on OpenJDK,App1App2App3Appx,PaaS,AAE: Alibaba Application Engine,Scaling tenant application with AAE spread application evenly across hosts but pack applications on the single JVM as mush as possible, based on its resource capacity: CPU usage Memory(monitoring GC),AAE,DC-1DC-2,A,B,A,B,

展开阅读全文
相关资源
相关搜索

当前位置:首页 > IT计算机/网络 > 云计算/并行计算

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号