MCache压力测试-1

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

二、目标:
1、通过压测寻找较优的GC策略,为线上可能出现的存储对象粒度情况寻找最优配置
2、寻找mcach瓶颈,优化程序以使GC最优
3、横向对比己有修改JVM方案(公司版本,提供NOGC堆分区),本地使用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:0chunksize:4096perslab:2freechunk:159188inusechunk:2604usedspace:660.68kevicted:0
slot:1chunksize:2048perslab:2freechunk:69211inusechunk:3493usedspace:1.19mevicted:0
slot:2chunksize:1024perslab:2freechunk:28855inusechunk:7046usedspace:1.06mevicted:0
slot:3chunksize:11264perslab:44freechunk:3866inusechunk:14163usedspace:26.32mevicted:0
slot:4chunksize:9088perslab:71freechunk:0inusechunk:9088usedspace:135.43mevicted:0
slot:5chunksize:4544perslab:71freechunk:0inusechunk:4544usedspace:576.16mevicted:1993
slot:6chunksize:2272perslab:71freechunk:0inusechunk:2272usedspace:843.24mevicted:74572
slot:7chunksize:1136perslab:71freechunk:0inusechunk:1136usedspace:56.14mevicted:224582
slot:8chunksize:568perslab:71freechunk:0inusechunk:568usedspace:52.95mevicted:449784
slot:9chunksize:284perslab:71freechunk:0inusechunk:283usedspace:52.20mevicted:899653
slot:10chunksize:626perslab:313freechunk:0inusechunk:625usedspace:229.30mevicted:1649585
slot:11chunksize:71perslab:71freechunk:71inusechunk:0usedspace:0.0bevicted:0

压测脚本每扫行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
usedtime:1112610.312ms
avgtime: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
usedtime:683642.063ms
avgtime:0.01ms

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

143858532.jpg

JVM情况

你可能感兴趣的:(压力测试,MCache)