当前位置:网站首页>[development of large e-commerce projects] performance pressure test - Performance Monitoring - heap memory and garbage collection -39
[development of large e-commerce projects] performance pressure test - Performance Monitoring - heap memory and garbage collection -39
2022-07-05 01:01:00 【Random stone light】
One : Performance monitoring jvm Memory model
1. Program counter Program Counter Register
- It records the address of the virtual machine bytecode instruction being executed ,
- This memory area is the only one in JAVA Nothing is specified in the virtual machine specification OutOfMemoryError Region
2. virtual machine VM Stack
- Describe the JAVA Memory model for method execution , Each method creates a stack frame when it executes , Used to store local variables , The stack of operands , Dynamic links , Method interface, etc
- The local variable table stores various basic data types known at compile time 、 Object reference
- If the stack depth requested by thread is not enough, it will report StackOverflowError abnormal
- If the dynamic expansion capacity of the stack is not enough, it will be reported that OutOfMemoryError abnormal
- The virtual machine stack is thread isolated , That is, each thread has its own independent virtual machine stack
3. Local method Native Stack
- The local method stack is similar to the virtual machine stack , It's just that the local method stack uses local methods
4. Pile up Heap
- Almost all object instances allocate memory on the heap
Two : Pile up
All object instances and arrays are allocated on the heap . The heap is the main area managed by the garbage collector , Also known as “GC Pile up ”; It's also the place that we consider most about optimization . Heaps can be subdivided into :
1. The new generation :Eden Space 、From Survivor Space 、To Survivor Space
2. Old age
3. Forever / Meta space :Java8 The old generation , suffer jvm management ,java8 After the meta space , Use physical memory directly . therefore , By default , The size of the meta space is limited only by local memory .
from Java8 Start ,HotSpot It has been completely replaced forever (Permanent Generation) remove , Instead, a A new area — Meta space (MetaSpace)
- After object creation , Go to the Cenozoic area first , If you can't put it down , Then take GC Garbage collection . Then go to the Cenozoic area , If you still can't put it down , Just go to the elderly area
- The elderly area is a situation that cannot be handled by the Cenozoic area , Will go in . If the elderly area can be put down , Then allocate memory . If you still can't put it down , Then carry out comprehensive GC
- If you still can't put it down , Memory overflow exception will be reported
- Elderly areas generally store objects with long-lasting vitality and large objects
- Eden The park can be put into the survivor area , If you can't put it in, put it in the elderly area
3、 ... and :jconsole And jvisualvm( Monitor local and remote applications )
Jdk Two of my little tools jconsole、jvisualvm( Upgraded version jconsole); Start... From the command line , Can monitor local and local Remote applications . Remote applications need to be configured
1.jconsole
1) Get into jconsole
win+r Get into cmd, Input jconsole
Double click the service you want to connect
2) View monitoring information
2.jvisualvm( Recommended )
1) start-up
win+r Get into cmd, Input jvisualvm
2)jvisualvm Can do
Monitor memory leaks , Tracking garbage collection , Memory at execution time 、cpu analysis , Thread analysis …
function : Running
Sleep :sleep
wait for :wait
Resident : Idle threads in the thread pool
monitor : Blocked threads , Waiting for lock
3) Install plug-ins for easy viewing of garbage collection (gc)
- Tools -> plug-in unit
- Available plug-ins -> Check for version updates
- If 503 Error resolution :
Open the urlhttps://visualvm.github.io/pluginscenters.html
cmd Check out your jdk edition , Find the corresponding - Copy the links found below . And reset it
- download gc plug-in unit
- see gc
边栏推荐
- Learn C language from scratch day 024
- Safety learning week4
- Compare whether two lists are equal
- POAP:NFT的采用入口?
- Analysis and comparison of leetcode weekly race + acwing weekly race (t4/t3)
- What you learned in the eleventh week
- 那些一门心思研究自动化测试的人,最后都怎样了?
- Inventory of more than 17 typical security incidents in January 2022
- Liangzai's first program life and annual summary in 2022
- What did I pay for it transfer to testing post from confusion to firmness?
猜你喜欢
分布式BASE理论
Binary conversion problem
Apifox (postman + swagger + mock + JMeter), an artifact of full stack development and efficiency improvement
Implementation steps of master detail detail layout mode of SAP ui5 application
FEG founder rox:smartdefi will be the benchmark of the entire decentralized financial market
【纯音听力测试】基于MATLAB的纯音听力测试系统
Basic operations of database and table ----- create index
Distributed base theory
Playwright之录制
【海浪建模1】海浪建模的理论分析和matlab仿真
随机推荐
Identifiers and keywords
“薪资倒挂”、“毕业生平替” 这些现象说明测试行业已经...
Several simplified forms of lambda expression
全网最全正则实战指南,拿走不谢
Paxos 入门
dotnet-exec 0.6.0 released
leetcode518,377
Inventory of more than 17 typical security incidents in January 2022
Check if this is null - checking if this is null
2022.07.03 (LC 6108 decryption message)
Detailed explanation of multi-mode input event distribution mechanism
Mongodb series learning notes tutorial summary
6. Scala operator
Paper notes multi UAV collaborative monolithic slam
【C】 (written examination questions) pointer and array, pointer
每日刷题记录 (十三)
lambda expressions
小程序直播 + 电商,想做新零售电商就用它吧!
Analysis and comparison of leetcode weekly race + acwing weekly race (t4/t3)
Discrete mathematics: reasoning rules