前言
因为redis的内存和持久化特性,对超过1M的value存储打算落在SSDB或者etcd这种文件存储方式,etcd是强一致性分布式kv结构,ssdb可以做双主同步,最后测试了etcd和ssdb结果也算意料之中吧,etcd虽然深度和层级都满足,但大size的value还是不适合。。经常会碰到raft内部协议错误,应该是日志同步保持一致性时members的response超时,最终还是决定使用ssdb的双主落地。
etcd测试
使用perl的lwp模块作http-put操作,1M文件大约2秒完成一次kv操作,set 5000层目录时遇到raft等错误。
ssdb可以使用redis-cli也可以使用ssdb-cli连接,测试主主同步:
- server 1配置
server:
ip:0.0.0.0
port: 38888
replication:
binlog: yes
# Limit sync speed to *MB/s, -1: no limit
sync_speed: -1
slaveof:
# to identify a master even if it moved(ip, port changed)
# if set to empty or not defined, ip:port will be used.
id: svc_2
# sync|mirror, default is sync
type: mirror
host: 192.168.6.151
port: 38889
- server 2配置
server:
ip: 0.0.0.0
port: 38889
replication:
binlog: yes
# Limit sync speed to *MB/s, -1: no limit
sync_speed: -1
slaveof:
# to identify a master even if it moved(ip, port changed)
# if set to empty or not defined, ip:port will be used.
id: svc_1
# sync|mirror, default is sync
type: mirror
host: 192.168.6.150
port: 38888
主主可以正常同步
//150
-bash-4.1$ redis-cli -p 38888
127.0.0.1:38888> set name jasonqi
OK
//151
-bash-4.1$ ./ssdb-cli -p 38889
ssdb (cli) - ssdb command line tool.
Copyright (c) 2012-2016 ssdb.io
'h' or 'help' for help, 'q' to quit.
ssdb-server 1.9.4
ssdb 127.0.0.1:38889> get name
jasonqi
用redis-benchmark测试ssdb读写性能
- 测试读性能
redis-benchmark -t get -h 192.168.6.151 -p 38889
====== GET ======
100000 requests completed in 2.36 seconds
50 parallel clients
3 bytes payload
keep alive: 1
99.89% <= 1 milliseconds
99.95% <= 39 milliseconds
99.97% <= 40 milliseconds
100.00% <= 41 milliseconds
100.00% <= 41 milliseconds
42444.82 requests per second
- 测试读和写性能,生成随机key使用ssdb-tools查看set key是否正常,主主同步正常
redis-benchmark -r 100000 -n 200000 -t get,set -q -p 38889
SET: 21473.05 requests per second
GET: 44903.46 requests per second
ssdb 127.0.0.1:38889> get key:000000099999
xxx
- 测试大报文,10M压测5000
redis-benchmark -n 5000 -q -d 10000000 -t get,set -p 38889
SET: 13.03 requests per second
GET: 57.27 requests per second