MCache压力测试-1

一、背景:
mcache是最近开发的一个本地缓存解决方案,利用direct内存,期望能在最低的FullGC触发情况下,利用本地内存作缓存,提高应用负载能力。

二、目标:
1、通过压测寻找较优的GC策略,为线上可能出现的存储对象粒度情况寻找最优配置
2、寻找mcach瓶颈,优化程序以使GC最优
3、横向对比己有修改JVM方案(公司版本,提供NO GC堆分区),本地使用memcached方案,使用direct方案,作性能评估


三、步骤:
1、调整JVM分区大小、GC方案以及程序调优,对比性能情况
2、结合direct和heap二种缓存性能情况
3、其它方案压测、对比


第一天

1、JVM配置
-Xmx2g
-Xmn512m
-verbose:gc
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+PrintGCDetails
-XX:+PrintTenuringDistribution
-XX:+PrintCommandLineFlags
-XX:+UseConcMarkSweepGC
-XX:ParallelCMSThreads=2
-XX:+CMSClassUnloadingEnabled
-XX:+UseCMSCompactAtFullCollection
-XX:CMSInitiatingOccupancyFraction=80
-XX:MaxDirectMemorySize=2g


2、结果
slab自动负载情况基本稳定
slot: 0 chunk size: 4096 perslab: 2 free chunk: 159188 inuse chunk: 2604 used space: 660.68k evicted: 0
slot: 1 chunk size: 2048 perslab: 2 free chunk: 69211 inuse chunk: 3493 used space: 1.19m evicted: 0
slot: 2 chunk size: 1024 perslab: 2 free chunk: 28855 inuse chunk: 7046 used space: 1.06m evicted: 0
slot: 3 chunk size: 11264 perslab: 44 free chunk: 3866 inuse chunk: 14163 used space: 26.32m evicted: 0
slot: 4 chunk size: 9088 perslab: 71 free chunk: 0 inuse chunk: 9088 used space: 135.43m evicted: 0
slot: 5 chunk size: 4544 perslab: 71 free chunk: 0 inuse chunk: 4544 used space: 576.16m evicted: 1993
slot: 6 chunk size: 2272 perslab: 71 free chunk: 0 inuse chunk: 2272 used space: 843.24m evicted: 74572
slot: 7 chunk size: 1136 perslab: 71 free chunk: 0 inuse chunk: 1136 used space: 56.14m evicted: 224582
slot: 8 chunk size: 568 perslab: 71 free chunk: 0 inuse chunk: 568 used space: 52.95m evicted: 449784
slot: 9 chunk size: 284 perslab: 71 free chunk: 0 inuse chunk: 283 used space: 52.20m evicted: 899653
slot: 10 chunk size: 626 perslab: 313 free chunk: 0 inuse chunk: 625 used space: 229.30m evicted: 1649585
slot: 11 chunk size: 71 perslab: 71 free chunk: 71 inuse chunk: 0 used space: 0.0b evicted: 


压测脚本每扫行1次sleep(1)的情况(线程之间上下文切换频繁,cpu占用低)
[dafu@v021129 ~]$ curl “localhost:8088/perf.do?method=mcache&times=10000000&min=128&max=502400&key=10000000&expire=3000&threads=5″
get: 693661
put: 675717
hit: 2.59%
qps: 623.45
used time: 1112610.312ms
avg time: 0.00ms
改为1000次sleep(1),比较合适:
[dafu@v021129 ~]$ curl “localhost:8088/perf.do?method=mcache&times=10000000&min=128&max=502400&key=10000000&expire=3000&threads=5″
get: 10000000
put: 6516443
hit: 34.84%
qps: 14,627.54
used time: 683642.063ms
avg time: 0.01ms


a) 压测脚本直接在Servlet中循环调用,没有停顿,cpu占用接近100%,会出现线程独占cpu不得释放的情况
b) 通过线程作sleep把cpu降下来了
c) 通过下图最后一段波看出,OLD占用会持续上升,且不能通过GC释放,待解决。



JVM情况


个人资料
0_0
等级:7
文章:111篇
访问:5.0w
排名: 6
上一篇: 通过visualvm远程监控jetty
下一篇:MCache压测-2
猜你感兴趣的圈子:
阿里中间件技术交流圈
标签: chunk、perslab、inuse、evicted、slot、面试题
隐藏