Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
zero-oclock
java-cpu-memory
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
java-cpu-memory
/
analysis_maximum_memory.txt
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
21 lines (20 loc) · 1.24 KB
master
Breadcrumbs
java-cpu-memory
/
analysis_maximum_memory.txt
Copy path
Top
File metadata and controls
Code
Blame
21 lines (20 loc) · 1.24 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
排查前须知:
1、内存占用率过高,会导致JVM超高频率full gc,频繁full gc会使CPU打满
2、基础模块如数据库出现瓶颈,会导致访问数据库的服务阻塞,相关连的web站点表现是servlet线程阻塞,外部请求被拒绝,循环遍历sevlet线程池会占用CPU,此时JVM也会尝试将热点代码转化为机器码这个动作也会占用大量CPU
3、死循环会占用大量CPU(概率比较低,比较容易解决)
排查步骤:
1、民工三连
通过使用top free df查看是否内存占用率过高,找出占用率异常的进程pid
2、进一步排查是否内存问题
输入如下命令,查看JVM gc情况,gc频繁则进一步印证是内存问题
jstat -gc pid 1000
3、保存堆和栈的现场快照
jstack pid > stack.log
jmap -dump:format=b,file=heap.log pid
4、分析栈
查看线程个数是否过多:
grep 'java.lang.Thread.State' stack.log | wc -l
查看线程都在干嘛:
grep -A 1 'java.lang.Thread.State' stack.log | grep -v 'java.lang.Thread.State' | sort | uniq -c | sort -n
5、分析堆
使用MAT分析heap.log,选择memory leak suspect,在Biggest Objects Retained Size饼状视图中查看内存占用情况,找出占用内存较多的对象,找出问题代码
You can’t perform that action at this time.