SSDB是一个快速的用来存储十亿级别列表数据的开源 NoSQL 数据库。
项目地址:https://github.com/ideawu/ssdb
http://ssdb.io/
特性
- 替代 Redis 数据库, Redis 的 100 倍容量
- LevelDB 网络支持, 使用 C/C++ 开发
- Redis API 兼容, 支持 Redis 客户端
- 适合存储集合数据, 如 list, hash, zset...
- 客户端 API 支持的语言包括: C++、PHP、Python、Cpy、Java、NodeJS、Ruby、Go。
- 持久化的队列服务
- 主从复制, 负载均衡
性能
1000请求:
并发:
在MacBook Pro 13 (Retina屏幕)上运行。
与redis的比较:
性能数据使用 ssdb-bench(SSDB) 和 redis-benchmark(Redis) 来获取。
架构
安装
下载压缩包,解压缩
编译
安装(可选)
运行
或者以后台的方式运行
ssdb命令行
停止ssdb-server
使用
PHP
Python
使用pyssdb
Ruby
使用ssdb-rb
Go
ngx_lua
使用lua-resty-ssdb
C++
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include
<stdio.h>
#include
<stdlib.h>
#include
<string>
#include
<vector>
#include
"SSDB.h"
int
main(int
argc,
char
**argv){
const
char
*ip
=
(argc
>=
2)?
argv[1]
:
"127.0.0.1";
int
port
=
(argc
>=
3)?
atoi(argv[2])
:
8888;
ssdb::Client
*client
=
ssdb::Client::connect(ip,
port);
if(client
==
NULL){
printf("fail
to connect to server!\n");
return
0;
}
ssdb::Status
s;
s
=
client->set("k",
"hello
ssdb!");
if(s.ok()){
printf("k
= hello ssdb!\n");
}else{
printf("error!\n");
}
delete
client;
return
0;
}
|