书签 分享 收藏 举报 版权申诉 / 26
上传文档赚钱

类型Java企业应用-性能优化原则, 方法与策略.pptx

  • 上传人(卖家):无敌的果实
  • 文档编号:5271765
  • 上传时间:2023-03-04
  • 格式:PPTX
  • 页数:26
  • 大小:1.25MB
  • 【下载声明】
    1. 本站全部试题类文档,若标题没写含答案,则无答案;标题注明含答案的文档,主观题也可能无答案。请谨慎下单,一旦售出,不予退换。
    2. 本站全部PPT文档均不含视频和音频,PPT中出现的音频或视频标识(或文字)仅表示流程,实际无音频或视频文件。请谨慎下单,一旦售出,不予退换。
    3. 本页资料《Java企业应用-性能优化原则, 方法与策略.pptx》由用户(无敌的果实)主动上传,其收益全归该用户。163文库仅提供信息存储空间,仅对该用户上传内容的表现方式做保护处理,对上传内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(点击联系客服),我们立即给予删除!
    4. 请根据预览情况,自愿下载本文。本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
    5. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007及以上版本和PDF阅读器,压缩文件请下载最新的WinRAR软件解压。
    配套讲稿:

    如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

    特殊限制:

    部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

    关 键  词:
    Java企业应用-性能优化原则 方法与策略 Java 企业 应用 性能 优化 原则 方法 策略
    资源描述:

    1、Java企业应用-性能优化原则,方法与策略Outline1.Performance Basics and Methodology2.Fundamentals of Performance Tuning Profiling Driven Optimization JVM Tuning GC JIT3.Optimization Strategy for JavaEE4.RecapRecall Littles lawL=*WIn queueing theory,the long-term average number ofcustomers in a stable system,L,is equal

    2、 to the long-termaverage arrival rate,multiplied by the average time acustomer spends in the system,Wsource:https:/en.wikipedia.org/wiki/Little%27s_lawThroughput and RTMeanNumberInSystem=MeanThroughput*MeanResponseTime.Throughput and RT are related Decreasing RT”almost always”improves Throughput Thr

    3、oughput improving doesnt necessarily mean RTdecreasing.Performance tuning and cost saving More higher throughput/lower RT but without addingnew hardwaresource:https:/en.wikipedia.org/wiki/Little%27s_lawApproaches to PerformanceApp Algorithm optimization Profiling-drivenAppServerJava VM Upgrade(JDK&O

    4、S)JVM(OS)Tuning SpecializationOperating SystemHardware Use new hardware Use cheaper hardwareJavas viewApproaches:a)Outside in approach(performance baseline)b)Layered approach(“Bottom up”or“Top down”)c)A hybrid of both a),b)Amdahls Scaling Law1Speedup=1+F:is fraction of workthat is serialN:is number

    5、ofthreadssource:https:/en.wikipedia.org/wiki/Amdahl%27s_law Reduce the amount of serial work performedCosts Reduce Scaling1.Potential contributors to F:.Synchronization(synchronized&j.u.c.Lock)data structures need to be thread.JConsole(MXBean).Java Mission Control.JProfilersafe communication overhea

    6、d between.HealthCenter&jucProfilerthreads.Infamous“stop the world”(aka STW)inJVM2.Cost incurred when the N gets increased.Thread context switchProfiling:Sampling vs Instrumentsamplingmethod callbarfoobarfoomainmainInstrumentbarfoomainAvailable Technology:BCI,JVMTi,javax.management,System.currentTime

    7、Millis()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 path Configuration on what methods to instrument Generally more data to be collectedSafep

    8、oint Bias.Stack trace sampling happens only when thegiven thread at a safepoint The hot loop may not get profiled anymore.Use following tools instead Java Mission Control Honest Profiler(githup)ZProfiler(alipay internal profiling tool)Tools for Diagnostics Most of them could be found in JAVA_HOEM/bi

    9、n Good reference:Troubleshooting Guide for JavaSE 6 withHotSpotVMBasics of JVM TuningGuild for GC Tuning Select the right GC algorithm parallel old,CMS and G1 collector Rule of thumb:GC overhead is ideally 10%Choose the right heap sizesource:Charlie Hunt,Binu John JavaTM performance Configure the ap

    10、propriate GG parametersJIT and common optimization Important concepts Profiler guided optimization(PGO)Optimization decisions are made dynamically Mix mode execution Some common optimization Inlining Intrinsic Monomorphic dispatch Liskov substitution principleSubtypes MUST be substitutablefor their

    11、base typesJIT Profiling with JITWatch JITWatch:a graphical visualization and analysis tool forunderstanding the JITEnabled by:-XX:+UnlockDiagnosticVMOptions-XX:+TraceClassLoading-XX:+LogCompilation-XX:+PrintAssemblyTypical distributed JEE architectureJava EE ContainerJava EE ApplicationRemote Bean v

    12、ia RMIREST Service via HTTPDB via JDBCSystem AcloudSystem BcloudSystem CcloudThe problem.Add communication cost RPC serialization/deserialization.Can not shift resources towardsdemand.Can not share the underlying Javaartifacts(such as JIT)Multitenancy for JavaEEAppApp1 App2 App3 AppxAppServerAppServ

    13、erJava VMJava VMOperating SystemHardwareOperating SystemHardware Run multiple Java EE applications(as tenants)into same Java EE containerHigh Density Cloud for JavaEEThe JavaEE applications developedseparately can be deployedseamlessly into the same container.devOps Orchestrate JavaEE application at

    14、scale Infrastructure Multi-tenant JavaEE container Virtualized JVMsource:https:/Tomcat/JDK extended for PaaS AliTomcat:run multiple apps side-by-sideApp1App3 AppxApp2safelyAliTomcat(Multi-tenant)AJDK(Virtualized)OS AJDK allows for collocation of multiple JEEapps(as tenant)in a single instance of JVM

    15、:Isolate application from one another.Share metadata aggressively andtransparently,such as:Hardware bytecodes of methods GC JIT:Alibaba/Alipay JDK,based on OpenJDKAAE:Alibaba Application Engine Scaling tenant application with AAE spread application evenly across hosts but pack applications on the si

    16、ngle JVM as mush as possible,based on its resource capacity:CPU usage Memory(monitoring GC)DC-1DC-2AAEgFaedacbaABABBenefitsCPU100%(100*30%+100*70%)/200=50%50%ABA+BBenefits(Cont.)Eliminate the unnecessary RPC Minimize the cost caused by object serialization/de-serialization Share underlying Java artifacts as much as possible GC JIT HeapCompared with DockerDDCCPUCPUBAABCMemMemOSOSHardwareHardwareCPU overcommit via dockershared memory viaMultitenancySummary What we covered:Performance basics&methodology Performance tuning Profiling Tuning from JVM perspective Multitenancy for JavaEE

    展开阅读全文
    提示  163文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    关于本文
    本文标题:Java企业应用-性能优化原则, 方法与策略.pptx
    链接地址:https://www.163wenku.com/p-5271765.html

    Copyright@ 2017-2037 Www.163WenKu.Com  网站版权所有  |  资源地图   
    IPC备案号:蜀ICP备2021032737号  | 川公网安备 51099002000191号


    侵权投诉QQ:3464097650  资料上传QQ:3464097650
       


    【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。

    163文库