Skip to content

Instantly share code, notes, and snippets.

View YorkHwang's full-sized avatar

York.Hwang YorkHwang

View GitHub Profile
@YorkHwang
YorkHwang / gist:ded9e32ec461e6fec72cdfdc0c05327c
Last active October 20, 2019 14:50
JedisPool loss data
I use JedisPool to connect redis,but it loss data.
codes are:
public void afterPropertiesSet() throws Exception {
Set<HostAndPort> jedisClusterNodes = new HashSet<HostAndPort>();
//Jedis Cluster will attempt to discover cluster nodes automatically
String[] servers = server.split(";|,");
for (String str : servers) {
String[] ap = str.split(":");
内存泄露排查:
1.找到PID: ps -ef|grep '[进程名关键字]'
2.间隔打印当前GC情况:jstat -gcutil [PID] [间隔打印的毫秒数]
3.查看当前内存排名前20的对象实例:jmap -histo:live [PID]|head -20
4.如果不明确,下载内存dump文件:jmap -dump:live,format=b,file=[path+fileName.hprof] [PID]
5.MAT工具(https://www.eclipse.org/mat/downloads.php)分析dump文件,关注泄露点:Leaks,查看内存占比
CPU消耗排查:
1.找到PID: ps -ef|grep '[进程名关键字]'
2.找到进程PID消耗cpu最多的线程:TID: ps -Lfp [PID] 或者 top -Hp [PID]