当前位置:网站首页>jvm是什么?jvm调优有哪些目的?
jvm是什么?jvm调优有哪些目的?
2022-07-06 22:03:00 【Blue92120】
jvm的组成
jvm是一种能够运行java字节码的虚拟机。由类装载子系统、运行时数据区(内存模型) 和字节码执行引擎三部分组成,跨平台 ,从软件层面屏蔽不同操作系统在底层硬件与指令上的区别,实现一处编写多处运行运行之前通过javac命令将转成字节码文件,当字节码文件运行时 JVM就开始工作了。
1.类装载子系统
2.运行时数据区:
堆 : new出来的对象都放在堆里,堆分为老年代和年轻代,老年代占整个堆的2/3,年轻代占1/3.年轻代又分为三块:伊甸园区,survivor区(s0和s1),比例8:1:1 .当伊甸园区里面的对象装满了,字节码引擎会执行一个垃圾回收线程(minor(蛮呢儿) gc)将非垃圾对象复制到survivor区,然后删除垃圾对象
栈 :只要一个线程在运行,Java虚拟机就会给这个线程分配一点内存空间, 这块空间就叫做线程栈(用来放方法内部自己的局部变量) 一个方法对应一块栈帧内存区域
程序计数器 :每一个程序运行的时候都会分配一个程序计数器,记录马上要执行代码的内存地址,作用就是当前线程被抢走执行权,恢复执行的时候就从记录的内存地址继续运行
方法区 : 存放常量,静态变量,类信息(字节码文件被加载后就放到方法区)
本地方法栈 :执行本地方法的时候分配的内存空间由本地方法栈提供,底层用C C++语言写的方法就是本地方法
3.字节码执行引擎
jvm调优
调优目的: 在回收垃圾的时候会停止用户进程(STW) stop the word ,专心做垃圾回收,减少GC(minor full)
为什么要有SWT: 当程序运行的过程中,产生了垃圾,full GC就开始找垃圾,从局部变量开始找完了所有的对象,都标记成非垃圾对象,然后在找其他变量.如果有一个线程,GC线程还没结束,它先结束了,那它里面的栈内存空间会被释放,释放掉就意味着局部变量表没有了,局部变量也被销毁了,那刚刚GC找垃圾的时候明明把这些对象标记未非垃圾对象,现在又变成垃圾了,这不合适 . 所以在回收垃圾的时候,让用户线程先停掉,不要影响对象的状态 , 标记好了再把垃圾清理,可能性能还要高一点
能否对JVM调优,让其几乎不发生Full GC :
调优工具: Arthas(阿尔萨斯) 它是阿里巴巴开源的java诊断工具,支持JDK6+,采用命令行交互模式.使用简便,监控进程。
边栏推荐
- 图灵诞辰110周年,智能机器预言成真了吗?
- On the 110th anniversary of Turing's birth, has the prediction of intelligent machine come true?
- Win11图片打不开怎么办?Win11无法打开图片的修复方法
- 【自动化经验谈】自动化测试成长之路
- 英特尔与信步科技共同打造机器视觉开发套件,协力推动工业智能化转型
- NanopiNEO使用开发过程记录
- SQL where multiple field filtering
- 软件测试之网站测试如何进行?测试小攻略走起!
- Food Chem | in depth learning accurately predicts food categories and nutritional components based on ingredient statements
- Hardware development notes (10): basic process of hardware development, making a USB to RS232 module (9): create ch340g/max232 package library sop-16 and associate principle primitive devices
猜你喜欢
测试/开发程序员怎么升职?从无到有,从薄变厚.......
[team learning] [34 issues] scratch (Level 2)
EasyCVR视频广场点击播放时,主菜单高亮效果消失问题的修复
各路行业大佬称赞的跨架构开发“神器”,你get同款了吗?
这项15年前的「超前」技术设计,让CPU在AI推理中大放光彩
[team learning] [phase 34] Baidu PaddlePaddle AI talent Creation Camp
The request request is encapsulated in uni app, which is easy to understand
[team learning] [34 sessions] Alibaba cloud Tianchi online programming training camp
kivy教程之设置窗体大小和背景(教程含源码)
Win11控制面板快捷键 Win11打开控制面板的多种方法
随机推荐
[written to the person who first published the paper] common problems in writing comprehensive scientific and Technological Papers
How to write a resume that shines in front of another interviewer [easy to understand]
Comment les tests de logiciels sont - ils effectués sur le site Web? Testez la stratégie!
两个div在同一行,两个div不换行「建议收藏」
[record of question brushing] 2 Add two numbers
超越Postman,新一代国产调试工具Apifox,用起来够优雅
On the 110th anniversary of Turing's birth, has the prediction of intelligent machine come true?
Deeply cultivate the developer ecosystem, accelerate the innovation and development of AI industry, and Intel brings many partners together
UltraEdit-32 warm prompt: right association, cancel bak file [easy to understand]
ACL2022 | 分解的元学习小样本命名实体识别
AI landing new question type RPA + AI =?
[team learning] [34 sessions] Alibaba cloud Tianchi online programming training camp
Win11控制面板快捷键 Win11打开控制面板的多种方法
How to solve the problem of adding RTSP device to easycvr cluster version and prompting server ID error?
True Global Ventures新成立的1.46亿美元后续基金关账,其中普通合伙人认缴6,200万美元以对后期阶段的Web3赢家进行投资
Learn how to use js to merge two objects into one object assign()
POJ training plan 2253_ Frogger (shortest /floyd)
Win11 control panel shortcut key win11 multiple methods to open the control panel
Digital chemical plant management system based on Virtual Simulation Technology
CUDA Programming