当前位置:网站首页>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+,采用命令行交互模式.使用简便,监控进程。
边栏推荐
- Comment les tests de logiciels sont - ils effectués sur le site Web? Testez la stratégie!
- C # use Siemens S7 protocol to read and write PLC DB block
- Deeply cultivate the developer ecosystem, accelerate the innovation and development of AI industry, and Intel brings many partners together
- 每人每年最高500万经费!选人不选项目,专注基础科研,科学家主导腾讯出资的「新基石」启动申报
- Nanopineo use development process record
- 见到小叶栀子
- Unit test asp Net MVC 4 Application - unit testing asp Net MVC 4 apps thoroughly
- 用头像模仿天狗食月
- 广告归因:买量如何做价值衡量?
- Both primary and secondary equipment numbers are 0
猜你喜欢

2022 electrician cup question B analysis of emergency materials distribution under 5g network environment
![[record of question brushing] 2 Add two numbers](/img/3b/f8fec79dc2b5088ac57f8d7a18aea6.png)
[record of question brushing] 2 Add two numbers

数学分析_笔记_第10章:含参变量积分

On the 110th anniversary of Turing's birth, has the prediction of intelligent machine come true?

英特尔与信步科技共同打造机器视觉开发套件,协力推动工业智能化转型

Win11玩绝地求生(PUBG)崩溃怎么办?Win11玩绝地求生崩溃解决方法

Digital chemical plants realize the coexistence of advantages of high quality, low cost and fast efficiency

MySQL data loss, analyze binlog log file

接口自动化测试实践指导(中):接口测试场景有哪些

Antd comment recursive loop comment
随机推荐
kivy教程之设置窗体大小和背景(教程含源码)
NFT meta universe chain diversified ecosystem development case
[knife-4j quickly build swagger]
[OA] excel document generator: openpyxl module
What if the win11 screenshot key cannot be used? Solution to the failure of win11 screenshot key
Kotlin Compose Text支持两种颜色
[coded font series] opendyslexic font
Ssm+jsp realizes enterprise management system (OA management system source code + database + document +ppt)
Unit test asp Net MVC 4 Application - unit testing asp Net MVC 4 apps thoroughly
2022 middle school Youth Cup mathematical modeling question B fertility policy research ideas under the background of open three children
Ssm+jsp realizes the warehouse management system, and the interface is called an elegant interface
软件测试之网站测试如何进行?测试小攻略走起!
mpf2_线性规划_CAPM_sharpe_Arbitrage Pricin_Inversion Gauss Jordan_Statsmodel_Pulp_pLU_Cholesky_QR_Jacobi
Deeply cultivate the developer ecosystem, accelerate the innovation and development of AI industry, and Intel brings many partners together
Comment les tests de logiciels sont - ils effectués sur le site Web? Testez la stratégie!
一度辍学的数学差生,获得今年菲尔兹奖
Analysis on the thinking of college mathematical modeling competition and curriculum education of the 2022a question of the China Youth Cup
【ArcGIS教程】专题图制作-人口密度分布图——人口密度分析
What is CGI, IIS, and VPS "suggested collection"
Easycvr cannot be played using webrtc. How to solve it?