性能测试
测试目标
1. 绑定接口性能:响应时长,并发量
2. 历史表500w数据下事务的处理情况
3. 压测过程线程状态
4. 压测过程堆状态
当前状态
1. 号池总量:1000000
2. T_REGINFO总量:20006
3. T_REGINFOHIS总量:4884369
测试服务器
系统版本
Linux testserver-centos 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
CPU信息
Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz X32
内存信息
MemTotal: 16215504 kB
MemFree: 5705052 kB
MemAvailable: 10554240 kB
Buffers: 28 kB
Cached: 5565036 kB
SwapCached: 518972 kB
Active: 5504676 kB
Inactive: 4168584 kB
Active(anon): 2818640 kB
Inactive(anon): 2020616 kB
Active(file): 2686036 kB
Inactive(file): 2147968 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 8126460 kB
SwapFree: 6607556 kB
Dirty: 84 kB
Writeback: 0 kB
AnonPages: 3626044 kB
Mapped: 218624 kB
Shmem: 731060 kB
Slab: 564724 kB
SReclaimable: 410288 kB
SUnreclaim: 154436 kB
KernelStack: 12608 kB
PageTables: 77320 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 16234212 kB
Committed_AS: 7857184 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 316296 kB
VmallocChunk: 34350563324 kB
HardwareCorrupted: 0 kB
AnonHugePages: 110592 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 363456 kB
DirectMap2M: 14270464 kB
DirectMap1G: 2097152 kB
数据服务器
系统版本
Linux weihua2 2.6.32-573.18.1.el6.i686 #1 SMP Tue Feb 9 19:51:22 UTC 2016 i686 i686 i386 GNU/Linux
CPU信息
Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz X32
内存信息
MemTotal: 8130136 kB
MemFree: 2471888 kB
Buffers: 347776 kB
Cached: 604844 kB
SwapCached: 28720 kB
Active: 4093188 kB
Inactive: 1380972 kB
Active(anon): 3596772 kB
Inactive(anon): 926380 kB
Active(file): 496416 kB
Inactive(file): 454592 kB
Unevictable: 0 kB
Mlocked: 0 kB
HighTotal: 7435208 kB
HighFree: 2288728 kB
LowTotal: 694928 kB
LowFree: 183160 kB
SwapTotal: 8273916 kB
SwapFree: 8214956 kB
Dirty: 28 kB
Writeback: 0 kB
AnonPages: 4493096 kB
Mapped: 33680 kB
Shmem: 1540 kB
Slab: 102100 kB
SReclaimable: 78500 kB
SUnreclaim: 23600 kB
KernelStack: 7672 kB
PageTables: 14536 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 12338984 kB
Committed_AS: 5936384 kB
VmallocTotal: 122880 kB
VmallocUsed: 7400 kB
VmallocChunk: 35868 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 10232 kB
DirectMap2M: 897024 kB
负载机
系统版本
Linux weihua1 2.6.32-279.el6.i686 #1 SMP Fri Jun 22 10:59:55 UTC 2012 i686 i686 i386 GNU/Linux
cpu信息
Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz X32
内存信息
MemTotal: 8130520 kB
MemFree: 5369356 kB
Buffers: 256976 kB
Cached: 2222852 kB
SwapCached: 7724 kB
Active: 1667240 kB
Inactive: 853124 kB
Active(anon): 15696 kB
Inactive(anon): 26080 kB
Active(file): 1651544 kB
Inactive(file): 827044 kB
Unevictable: 0 kB
Mlocked: 0 kB
HighTotal: 7435208 kB
HighFree: 5249168 kB
LowTotal: 695312 kB
LowFree: 120188 kB
SwapTotal: 8273912 kB
SwapFree: 8201640 kB
Dirty: 4080 kB
Writeback: 0 kB
AnonPages: 33944 kB
Mapped: 14192 kB
Shmem: 1240 kB
Slab: 150052 kB
SReclaimable: 130256 kB
SUnreclaim: 19796 kB
KernelStack: 6600 kB
PageTables: 5184 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 12339172 kB
Committed_AS: 588200 kB
VmallocTotal: 122880 kB
VmallocUsed: 7064 kB
VmallocChunk: 84064 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 10232 kB
DirectMap2M: 897024 kB
测试准备
1. 测试工具:jmeter 4.0;
2. 测试数据:csv 100w;
3. 线程组:500并发,60秒增长时间,600秒持续时间。
测试结果一
未开启TIME_WAIT重用,FIN_WAIT_2状态时间为60
聚合分析
响应时长
测试结果二
开启TIME_WAIT重用,FIN_WAIT_2状态时间为30
聚合分析
响应时长
数据库访问情况
T_REGINFOHIS表
- 数据量:4884369
表结构
CREATE TABLE `T_REGINFOHIS` ( `hisid` bigint(16) NOT NULL AUTO_INCREMENT, `addtime` datetime DEFAULT NULL, `opuidtype` char(1) DEFAULT NULL, `uidnumber` varchar(16) DEFAULT NULL, `regphone` varchar(32) DEFAULT NULL, `subid` bigint(16) DEFAULT NULL, `regtime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `regmodule` varchar(16) DEFAULT NULL, `uidtype` varchar(8) DEFAULT NULL, `callrestrict` varchar(8) DEFAULT NULL, `callrecording` varchar(4) DEFAULT NULL, `anucode` varchar(64) DEFAULT NULL, `bnucode` varchar(64) DEFAULT NULL COMMENT '被叫放音', `calldisplay` varchar(16) DEFAULT NULL, `productid` int(11) DEFAULT NULL, `name` varchar(32) DEFAULT NULL, `cardtype` varchar(32) DEFAULT NULL, `cardno` varchar(32) DEFAULT NULL, `calldisplaynouid` varchar(32) DEFAULT NULL, `unitid` varchar(64) DEFAULT NULL, `expiretime` datetime DEFAULT NULL, `logid` bigint(10) DEFAULT NULL, `uuidinpartner` varchar(64) DEFAULT NULL, `batchworkid` varchar(36) DEFAULT NULL, `opuser` varchar(64) DEFAULT NULL, PRIMARY KEY (`hisid`,`regtime`), KEY `ind_uidnumber` (`uidnumber`), KEY `ind_regphone` (`regphone`), KEY `ind_uuidinpartner` (`uuidinpartner`) ) ENGINE=InnoDB AUTO_INCREMENT=5884370 DEFAULT CHARSET=utf8
T_REGINFO表
- 数据量:20006
表结构
CREATE TABLE `T_REGINFO` ( `uidnumber` varchar(16) DEFAULT NULL, `regphone` varchar(32) DEFAULT NULL, `subid` bigint(16) NOT NULL AUTO_INCREMENT, `regtime` datetime DEFAULT NULL, `regmodule` varchar(16) DEFAULT NULL, `uidtype` varchar(8) DEFAULT NULL, `callrestrict` varchar(8) DEFAULT NULL, `callrecording` varchar(4) DEFAULT NULL, `anucode` varchar(64) DEFAULT NULL, `bnucode` varchar(64) DEFAULT NULL COMMENT '被叫放音', `calldisplay` varchar(16) DEFAULT NULL, `productid` int(11) DEFAULT NULL, `name` varchar(32) DEFAULT NULL, `cardtype` varchar(32) DEFAULT NULL, `cardno` varchar(32) DEFAULT NULL, `calldisplaynouid` varchar(16) DEFAULT NULL, `unitid` varchar(16) DEFAULT NULL, `expiretime` datetime DEFAULT NULL, `uuidinpartner` varchar(64) DEFAULT NULL, `batchworkid` varchar(36) DEFAULT '', `opuser` varchar(64) DEFAULT NULL, PRIMARY KEY (`subid`), KEY `ind_reginfo_batchworkid` (`batchworkid`) USING BTREE, KEY `ind_reginfo_uuidinpartner` (`uuidinpartner`) USING BTREE, KEY `ind_reginfo_uidnumber` (`uidnumber`), KEY `ind_reginfo_regphone` (`regphone`) ) ENGINE=InnoDB AUTO_INCREMENT=3452188 DEFAULT CHARSET=utf8;
sql语句
写入T_REGINFOHIS
INSERT INTO T_REGINFOHIS (hisid, addtime, opuidtype, uidnumber, regphone , subid, regtime, regmodule, uidtype, callrestrict , callrecording, anucode, bnucode, calldisplay, productid , name, cardtype, cardno, calldisplaynouid, unitid , expiretime, logid, uuidinpartner, batchworkid, opuser) VALUES (?, now(), ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ?)
写入T_REGINFO
INSERT INTO T_REGINFO (subid, uidnumber, regphone, regtime, regmodule , uidtype, callrestrict, callrecording, anucode, bnucode , calldisplay, productid, name, cardtype, cardno , calldisplaynouid, unitid, expiretime, uuidinpartner, batchworkid , opuser) VALUES (?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?, ?, ?, ?, ? , ?)
sql统计结果
用例 | 执行数 | 执行时间 | 最慢 | 时间分布 | 平均时间 |
写入T_REGINFOHIS | 1,000,000 | 33,850,801 | 8,945 | [310988,441162,157808,86465,3577,0,0,0] | 33.9 |
写入T_REGINFO | 1,000,000 | 37,210,288 | 8,906 | [403461,337974,188582,64237,5746,0,0,0] | 37.2 |