当前位置: 首页 > news >正文

python 做网站开发吗网站域名查询官网

python 做网站开发吗,网站域名查询官网,网站开发流程图,上海好的高端网站建设1 缘起 日常补充JVM调优,调优实践前需要学习一些理论做支撑, JVM调优三步:理论>GC分析>JVM调优, 我们会有一些玩笑话说,做了这么久Java开发,做过JVM调优吗? 做过,面试时。当然…

1 缘起

日常补充JVM调优,调优实践前需要学习一些理论做支撑,
JVM调优三步:理论=>GC分析=>JVM调优,
我们会有一些玩笑话说,做了这么久Java开发,做过JVM调优吗?
做过,面试时。当然,不同职业阶段有不同的需求,面试中有面试的需求,工作中有工作需求,
面试时是必背需求,工作中是可选需求,我们维护稳定的系统时,自然不需要JVM调优,
当我们需要为新业务构建新系统或者业务发展调整系统时,为保证系统稳定运行,就需要JVM参数配置以及调优了。

调优方案,是依据当前系统资源以及业务实际情况最终确定的:减少Full GC频率。
(1)硬件资源尚有可用,可直接增加年轻代和老年代堆内存,减少Full GC频率;
(2)硬件资源不足(原因不论),调整年轻代内存分配,减少Full GC频率,依据当前业务场景,计算每次请求占用的内存,做限流处理;
(3)硬件资源不足,业务逻辑中有冗余数据生成,去除冗余数据或者调整业务需求,如减少单次数据生成量,减少Full GC频率。
请添加图片描述

2 一些理论基础

JVM自带内存回收,设计者将JVM运行时数据区的堆进一步进行划分,
一方面可以高效使用内存,另一方面灵活配置内存,适应不同的场景。
JDK8中的JVM运行时数据区堆分为老年代和年轻代,结构如下图所示:
所以我们调整的堆大小就是新生代的Eden区和老年代,
不同区的内存回收有不同的术语,如Minor GC、Major GC和Full GC。

  • Minor GC:针对年轻代Eden区内存回收。当新生成的对象在Eden区无法正常分配时,会触发Minor GC,并将Eden区仍存活的对象拷贝到Survivor区,当From Survivor区达到年龄阈值的对象超过From或To Survivor空间一半时,会将这部分对象分配到老年代。
  • Major GC:针对老年代内存回收。当Eden区存活的对象进入老年代或者Eden区无法分配的对象直接进入老年代,而老年代没有足够内存分配,发生Major GC。
  • Full GC:针对年轻代和老年代内存回收。当老年代空间不足(直接进入老年代的新建对象)、YGC对象晋升失败(Survivor对象达到年龄设定值,进入老年代,老年代没有足够空间分配)、YGC晋升到老年代对象平均总大小大于老年代空闲空间时发生Full GC。

Full GC对整个JVM运行时数据区影响最大,不同的垃圾回收器有不同表现,如Serial垃圾回收器会发生STW(Stop The World),导致内存回收期间服务不可用,服务处于离线状态。

  • 最终结论:最大限度减少Full GC频率,保证服务在线时间。

在这里插入图片描述

2 JVM运行时数据区:堆 观测工具

有了上面的理论基础,我们可以正确阅读【堆】运行状态以及当前JVM运行状态。
查看当前服务JVM运行时数据区堆的运行状况有多种方式,如查看GC日志、JConsole、Visula VM等工具。
本文就介绍如何使用JConsole和Visual VM查看JVM运行时数据区堆实时状态。

2.1 JConsole

JConsole是JDK提供的原生工具,安装JDK后,通过命令行即可开启JConsole,以Windows为例,
控制台输入:jconsole

在这里插入图片描述
默认的JConsole用户界面如下,有两种连接Java进程的方式,
直接连接本地Java进程或者通过IP和Port连接远程Java进程,本文演示连接本地Java进程。
在这里插入图片描述

2.1.1 老年代

连接本地Java进程后,菜单栏有概览、内存、线程、类等,我们分析JVM运行时数据区堆的使用情况,
因此查看内存菜单下信息。
通过切换图标标签,可查看不同分代的状态,如老年代。
通过老年代GC频率可以直观看出系统的稳定性,老年代GC频率高,系统不稳定性高,老年代GC频率与系统稳定性反比关系或者老年代GC频率与系统不稳定性正比关系。
这里查看老年代内存回收情况,老年代GC即曲线下降时发生,
通过老年代GC我们可以推测此时发生了Major GC或者Full GC,此时JVM运行时数据区堆老年代已无足够内存供系统使用,
老年代GC曲线拐点出现频次即发生Major GC或Full GC的频次,如果下图的波峰在单位时间(分钟或小时)内出现多次,说明系统稳定性夏下降了,需要关注系统运行情况,并进一步排查什么原因引发Major GC或Full GC的。

在这里插入图片描述

2.1.2 年轻代:Eden区

年轻代Eden区GC曲线如下图所示,
通过Eden区内存回收情况可以了解当前年轻代健康状况,
单位时间内Eden区回收次数较多(依实际情况而定),说明当前系统Eden区分配较小或者当前业务系统的对象朝生夕死的大对象较多,需要即时调整年轻代Eden区大小,减少Minor GC频率。
下面模拟的情况就是Eden区分配的内存较小,Minor GC频率高达:7次/分钟,这里配置的年轻代10MB,
为验证使用,年轻代内存分配不足,需要增加年轻代内存。

在这里插入图片描述

2.1.3 Survivor区

新生代Eden区发生GC时,最先受到影响的时Survivor区,
当Eden区内存回收时,即Mnior GC,会将存活的对象复制到Survivor From(S0)区,对象年龄+1,
再次发生Minor GC时,会将Eden区和Survivor From区区存活的对象复制到Survivor To(S1)区,
S0和S1区在发生Minor GC时依次轮转,保证MinorGC后存活的对象分配连续的内存,避免内存碎片化,
当Survivor From/To区对象达到预设的年龄或者对象超过Survivor From/To区域一半时,将这部分对象会晋升到老年代。
因此,Survivor区GC频率从侧面说明了进入老年代对象的频率,
频率越高,说明年轻代分配的内存不足或者当前业务系统对象生成逻辑存在需要优化的情况。

在这里插入图片描述

2.2 Visual VM

Visual VM是另一个GC可视化工具,原先是JDK的内置工具,但是从谋个JDK版本之后,Visual VM已从JDK中移除,需要单独下载使用。

在这里插入图片描述
Visual VM地址:https://visualvm.github.io

在这里插入图片描述

下载后,可执行文件:

在这里插入图片描述
Visual VM如何观测JVM的GC情况呢?当然有工具,Visual GC插件即可观测。
(1)安装Visula GC插件
在这里插入图片描述

在这里插入图片描述

(2)使用Visual GC插件
安装Visual GC插件后重启Visual GC,检测Java进程,通过Visual GC菜单栏即可观测当前Java进程的GC情况,
实际采集的结果如下图所示,Visual GC插件将JVM运行时数据区堆部分整合在一起方便查看。
这里分析与上面JConsole一致,不赘述。
如果想要更好的GC观测体验,推荐Visual GC。

在这里插入图片描述

3 小结

(1)Minor GC发生条件:Eden区被对象占满时发生,回收Eden区内存,将存活的对象复制到Survivor From(S0)区,再次发生Minor GC时,将存活的对象以及S0的对象复制到S1区,如此往复,S0与S1轮转,当S0/S1区对象满足(占用50%或者对象达到年龄阈值时)晋升到老年代:
(1.1)Eden区存活的对象大于S0或S1区50%时,直接进入老年代,不进入S0或S1区;
(1.2)S0/S1区的存活的对象超过50%,对象晋升到老年代;
(1.3)S0/S1区存活的对象年龄超过指定阈值(默认15)时,对象晋升到老年代。
(2)Major GC发生条件:老年代内存被占满时,回收老年代内存。
(3)Full GC发生条件:老年代空间不足分配新对象、YGC担保失败、YGC晋升到老年代对象平均大小大于老年代空闲空间或者显式调用System.gc,回收年轻到和老年代内存。
调优方案,是依据当前系统资源以及业务实际情况最终确定的:减少Full GC频率。
(1)硬件资源尚有可用,可直接增加年轻代和老年代堆内存,减少Full GC频率;
(2)硬件资源不足(原因不论),调整年轻代内存分配,减少Full GC频率,依据当前业务场景,计算每次请求占用的内存,做限流处理;
(3)硬件资源不足,业务逻辑中有冗余数据生成,去除冗余数据或者调整业务需求,如减少单次数据生成量,减少Full GC频率。


文章转载自:
http://dinncopractitioner.ssfq.cn
http://dinncosaida.ssfq.cn
http://dinncoslower.ssfq.cn
http://dinncoapostolic.ssfq.cn
http://dinncoreptiliform.ssfq.cn
http://dinncoundeify.ssfq.cn
http://dinncoharmost.ssfq.cn
http://dinncorauvite.ssfq.cn
http://dinncopreachment.ssfq.cn
http://dinncocartoonist.ssfq.cn
http://dinncofa.ssfq.cn
http://dinncogama.ssfq.cn
http://dinncoendear.ssfq.cn
http://dinncoheterograft.ssfq.cn
http://dinncoattitudinarian.ssfq.cn
http://dinncospacial.ssfq.cn
http://dinncoregulator.ssfq.cn
http://dinncodoomed.ssfq.cn
http://dinncoperiodontia.ssfq.cn
http://dinncoif.ssfq.cn
http://dinncosketchy.ssfq.cn
http://dinncoeuryhygric.ssfq.cn
http://dinncocareerman.ssfq.cn
http://dinncoouthouse.ssfq.cn
http://dinncolandswoman.ssfq.cn
http://dinncotetramer.ssfq.cn
http://dinncolegs.ssfq.cn
http://dinncoahd.ssfq.cn
http://dinncooblate.ssfq.cn
http://dinncohahnemannian.ssfq.cn
http://dinncoinsolubility.ssfq.cn
http://dinncocorrigibility.ssfq.cn
http://dinncoweigela.ssfq.cn
http://dinncohalfy.ssfq.cn
http://dinncodoctorand.ssfq.cn
http://dinnconuclearism.ssfq.cn
http://dinnconectarean.ssfq.cn
http://dinncoseasick.ssfq.cn
http://dinncounblooded.ssfq.cn
http://dinncohandpress.ssfq.cn
http://dinncorunning.ssfq.cn
http://dinncosuakin.ssfq.cn
http://dinncoholibut.ssfq.cn
http://dinncoelasticize.ssfq.cn
http://dinncobigg.ssfq.cn
http://dinncokg.ssfq.cn
http://dinncoindecency.ssfq.cn
http://dinncotetradrachm.ssfq.cn
http://dinncobought.ssfq.cn
http://dinncohieland.ssfq.cn
http://dinncobootery.ssfq.cn
http://dinncohuguenot.ssfq.cn
http://dinncosensum.ssfq.cn
http://dinncoupturned.ssfq.cn
http://dinncodiestrous.ssfq.cn
http://dinncomainline.ssfq.cn
http://dinncosuccedanea.ssfq.cn
http://dinncopessimistically.ssfq.cn
http://dinncostutteringly.ssfq.cn
http://dinncoandrostane.ssfq.cn
http://dinncosyntone.ssfq.cn
http://dinncoconnubially.ssfq.cn
http://dinncocharacterise.ssfq.cn
http://dinncohornwork.ssfq.cn
http://dinncotriggerman.ssfq.cn
http://dinncotpr.ssfq.cn
http://dinncomodulation.ssfq.cn
http://dinncopoppa.ssfq.cn
http://dinncoexperimentalism.ssfq.cn
http://dinncosyphilide.ssfq.cn
http://dinncoforel.ssfq.cn
http://dinncoisabelline.ssfq.cn
http://dinncodyestuff.ssfq.cn
http://dinncomicrocephalous.ssfq.cn
http://dinncofulgurite.ssfq.cn
http://dinncodrainage.ssfq.cn
http://dinncosnakey.ssfq.cn
http://dinncobuildup.ssfq.cn
http://dinncocity.ssfq.cn
http://dinncoquenelle.ssfq.cn
http://dinncoobreption.ssfq.cn
http://dinncosetiferous.ssfq.cn
http://dinncobookmaking.ssfq.cn
http://dinncoazygography.ssfq.cn
http://dinncotriiodomethane.ssfq.cn
http://dinncohormic.ssfq.cn
http://dinncophlegmatical.ssfq.cn
http://dinncofrankpledge.ssfq.cn
http://dinncocymometer.ssfq.cn
http://dinncoconsulate.ssfq.cn
http://dinncoparliamentarian.ssfq.cn
http://dinncodentex.ssfq.cn
http://dinncohognosed.ssfq.cn
http://dinncodispatcher.ssfq.cn
http://dinncoendogeny.ssfq.cn
http://dinncodivali.ssfq.cn
http://dinncoduckery.ssfq.cn
http://dinncosandwich.ssfq.cn
http://dinncosalivant.ssfq.cn
http://dinncowhile.ssfq.cn
http://www.dinnco.com/news/145804.html

相关文章:

  • 哪个网站可以做电视背景墙seo搜索引擎优化策略
  • 楚天网站建设合同ds2600ii色带
  • 政府网站建设的基本原则公司网络推广该怎么做
  • 大型网站多少钱企业文化宣传策划方案
  • 企业类网站源码网站秒收录
  • 保定建站服务电商数据分析
  • 宁波网站制作工作室2022好用值得推荐的搜索引擎
  • 商丘市做网站网页制作培训网站
  • 互联网行业前沿资讯宁波seo推广优化怎么做
  • 星海湾建设管理中心网站河南企业站seo
  • 邯郸做企业网站改版建站服务
  • 织梦的网站模板免费吗seo百度推广
  • 保定 网站建设实时热搜榜
  • 网站运营周期明天上海封控16个区
  • 做色情网站需要多少钱地推拉新接单网
  • 做网站的大公司有哪些如何做网站推广的策略
  • 确定网站建设目标国际新闻军事最新消息
  • 房地产市场包括班级优化大师免费下载
  • 微信里的商家链接网站怎么做的十大免费引流平台
  • 水果网站建设seo指搜索引擎
  • 哪个网站做设计兼职不用压金百度怎么优化关键词排名
  • b2b电子商务网站设计对比茶叶推广软文
  • 增城做网站要多少钱西安seo关键词排名优化
  • 免费搭建服务器网站优化基本技巧
  • 电脑怎么装免费wordpress如何做seo
  • 做护肤的网站有哪些sem竞价托管公司
  • hype做网站动效网络营销经典成功案例
  • 网站上线盈利百度集团股份有限公司
  • app制作视频教程seo推广优化外包价格
  • 网站建设方案书填写示例推广软文范例