当前位置: 首页 > 工具软件 > Memlink > 使用案例 >

MemLink 性能测试

贲永思
2023-12-01

Introduction

Memlink用于持久化存储论坛中forum=>thread list,thread=>post list数据,下面对比了不同数据存储引擎存储上述逻辑关系的查询性能和内存开销。

Details

硬件

OS:CentOS release 4.6 (Final) 

内存:4G 

CPU:Intel(R) Xeon(R) CPU E5405 @ 2.00GHz (四核)

硬盘:250G SATA 

数据模型

CREATE TABLE `ThreadList` (
  `forumid` int(11) NOT NULL,
  `threadid` char(12) NOT NULL,
  `status` bit(1) DEFAULT 0,
  `reply_time` datetime NOT NULL,
  KEY `threadlist` (`forumid`,`reply_time`,`status`)
) ENGINE=Innodb DEFAULT CHARSET=utf8;

memlink

c:表示c客户端每秒操作成功条数,py:表示python客户端每秒操作成功条数,php:为php客户端每秒操作成功条数。mem:表示memlink server消耗内存。 insert为插入操作,range为获取列表某个范围的操作。插入的列表中的数据每条为12字节。

redis

redis测试一样每条数据是12字节。redis只测试c客户端,使用hiredis。用LRANGE命令获取列表,用LPUSH向队列插入数据。redis是默认配置。

mysql

mysql使用上面的数据库表结构。插入语句为:insert into ThreadList values (1, 'xxxx', 0, now()) 查询列表的语句为:select threadid from ThreadList where forumid=1 order by reply_time limit frompos,len

1. 一个客户端,长连接

memlink

 

操作1w10w100w1000w
insert

mem:4764K
c:16296

py:12558

php:12153

mem:5032K
c:14125

py:12565

php:12144

mem:6628K
c:13868

py: 13096

php: 12521

mem:18M
c:13187

py:12611

php:12124

mem:139M
range first100c:10874

py:8275

php:9185
c:11429

py:8273

php:9171
c:10994

py:8068

php:9136
c:11663

py:8256

php:10071
range first200c:8045

py:6015

php:6544
c:8041

py:6017

php:6545
c:7863

py:5941

php:6542
c:7970

py:6024

php:7010
range first1000c:1362

py:1446

php:1466
c:1362

py:1448

php:1468
c:1354

py:1440

php:1462
c:1362

py:1444

php:1492
range last100c:11153

py:8137

php:8996
c:10318

py:7526

php:8263
c:5519

py:4410

php:4691
c:112

py:97

php:97
range last200c:7938

py:5956

php:6461
c:7515

py:5629

php:6078
c:4615

py:3688

php:3899
c:111

py:96

php:97
range last1000c:1358

py:1442

php:1458
c:1345

py:1421

php:1440
c:1209

py:1251

php:1272
c:103

py:91

php:91

 

redis

操作1w10w100w1000w
insert

mem:1060K
15183

mem:1920K
14997

mem:9044
14828

mem:78M
14788

mem:771M
range first1001328132913241332
range first200708709705709
range first1000147148148147
range last1001221212192
range last200675184192
range last100014792172

 

mysql

操作1w10w100w1000w
insert1089110297100229718
range first1001550156315591307
range first200956954956941
range first1000230230230235
range last1003130.30.04
range last2003130.30.04
range last10003030.30.03

 

2. 一个客户端, 全部是短连接。一次请求一个连接。

memlink

操作1w10w100w1000w
insert

mem:4760K
c:6560

py:6138

php:6064

mem:5108K
c:6466

py:5990

php:5986

mem:6704K
c:6675

py:6092

php:6010

mem:18M
c:6719

py:6012

php:6003

mem:139M
range first100c:5467

py:4535

php:5064
c:5472

py:4450

php:4944
c:5662

py:4495

php:4712
c:5484

py:4475

php:4779
range first200c:4533

py:3746

php:4124
c:4563

py:3693

php:4049
c:4709

py:3724

php:3893
c:4567

py:3708

php:3931
range first1000c:1206

py:1254

php:1291
c:1200

py:1249

php:1285
c:1215

py:1253

php:1263
c:1202

py:1250

php:1266
range last100c:5468

py:4451

php:4970
c:5229

py:4233

php:4692
c:3763

py:3055

php:3155
c:110

py:96

php:96
range last200c:4558

py:3692

php:4053
c:4355

py:3545

php:3886
c:3323

py:2680

php:2790
c:110

py:95

php:96
range last1000c:1198

py:1247

php:1284
c:1191

py:1226

php:1267
c:1096

py:1093

php:1125
c:102

py:91

php:91

 

redis

操作1w10w100w1000w
insert10891102971023310135
range first1001058117211661163
range first200654651669667
range first1000146145145144
range last100994271323
range last200630233323
range last1000144104273

 

mysql

操作1w10w100w1000w
insert3313325131083001
range first10092311581031885
range first200815823783743
range first1000227230226212
range last1002030.210.02
range last2003030.30.04
range last10003030.30.03

 

3. 10个客户端,并发长连接。

memlink内部开启4个处理线程。仅c客户端测试。

操作1w10w100w1000w
insert23021222102220022242
range first10045451534635564548283
range first20023768339663504535417
range first10004269430542814271
range last100537194894824086295
range last200355933426421830292
range last1000428542704336277

 

redis

操作1w10w100w1000w
insert29401309292910930278
range first1001443138413961339
range first200667641636655
range first1000114115114115
range last1001584229192
range last200696220192
range last1000114142192

 

mysql

操作1w10w100w1000w
insert13704127861208711023
range first1002011205920152387
range first2001637176818541614
range first1000654641648631
range last1009181-
range last2009691-
range last10009181-

 

上面的 - 表示时间太长,数百秒也没有结果。

4. 10个客户端,并发短连接

Memlink内部开启4个处理线程。仅c客户端测试。

操作1w10w100w1000w
insert966596501007810183
range first10017400175041661417292
range first20015786157721596416180
range first10003795391837033250
range last100169891650213118319
range last200159151559612203316
range last1000389336413332299

 

redis

操作1w10w100w1000w
insert9381948989938976
range first1001695163716961586
range first200711711719692
range first1000118115116114
range last1002132240202
range last200743229202
range last1000120174192

 

mysql

操作1w10w100w1000w
insert5623562154685306
range first1002210228619551611
range first2001444179118701402
range first1000550692620686
range last1008081-
range last2009491-
range last10009491-

 

 类似资料: