Giter Site home page Giter Site logo

kraret / ssdb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ideawu/ssdb

12.0 6.0 9.0 3.99 MB

SSDB - A fast NoSQL database, an alternative to Redis

Home Page: ssdb.io

License: BSD 3-Clause "New" or "Revised" License

Makefile 1.39% COBOL 2.53% PHP 4.27% Python 2.68% Shell 1.16% C++ 87.49% C 0.49%

ssdb's Introduction

This fork modified build.sh and Makefile for using ssdb with TerarkDB's leveldb compatible api.

Before using this modified ssdb, you should download TerarkDB and uncompress to /path/to/TerarkDB, for compiling this ssdb, you should execute env TERARK_DB_HOME=/path/to/TerarkDB make.

TerarkDB's leveldb compatible api leveldb::DB::open(dbpath) put db files into dbpath/TerarkDB. For ssdb, dbpath is configured in ssdb.conf, by var work_dir. TerarkDB's leveldb::DB::open will create a default dbpath/TerarkDB/dbmeta.json, if you want to change db config parameters, create your own dbpath/TerarkDB/dbmeta.json before open the db, see more document of dbmeta.json, the default dbmeta.json for leveldb is:

{
  "RowSchema": {"columns": {
      "key": {"type": "carbin"}, "val": {"type": "carbin"}
  }},
  "TableIndex": [ {"fields": "key", "unique": true} ]
}

The official ssdb benchmark is really for sequencial get on program-generated data, see our ssdb benchmark for random multi-get on real data

Note: DONT start ssdb-server with -d (daemon) option, its daemonize will cause TerarkDB background threads exit. USE `nohup ./ssdb-server ssdb.conf` instead

SSDB - A fast NoSQL database for storing big list of data

Author Platform NoSQL License

SSDB is a high performace key-value(key-string, key-zset, key-hashmap) NoSQL database, an alternative to Redis.

SSDB is stable, production-ready and is widely used by many Internet companies including QIHU 360.

Features

  • LevelDB client-server support, written in C/C++
  • Designed to store collection data
  • Persistent key-value, key-zset, key-map('hashmap') storage
  • Redis clients are supported
  • Client API supports including C++, PHP, Python, Cpy, Java, nodejs, Ruby, Go(see all)
  • Persistent queue service
  • Replication(master-slave), load balance
  • GUI administration tool(phpssdbadmin)
  • Built-in CLI nagios self-checks

PHP client API example

<?php
require_once('SSDB.php');
$ssdb = new SimpleSSDB('127.0.0.1', 8888);
$resp = $ssdb->set('key', '123');
$resp = $ssdb->get('key');
echo $resp; // output: 123

More...

Who's using SSDB?

all-ssdb-users

And more...

Documentation

Compile and Install

$ # wget --no-check-certificate https://github.com/ideawu/ssdb/archive/master.zip
$ # use Terark fork instead:
$ wget --no-check-certificate https://github.com/Terark/ssdb/archive/master.zip
$ unzip master
$ cd ssdb-master
$ # For building with TerarkDB's leveldb api
$ # TERARK_DB_HOME is the directory which contains subdir 'api'
$ env TERARK_DB_HOME=/path/to/TerarkDB make
$ #optional, install ssdb in /usr/local/ssdb
$ sudo make install

# start master
$ ./ssdb-server ssdb.conf

# or start as daemon
$ ./ssdb-server -d ssdb.conf

# ssdb command line
$ ./tools/ssdb-cli -p 8888

# stop ssdb-server
$ ./ssdb-server ssdb.conf -s stop
 # for older version
$ kill `cat ./var/ssdb.pid`

See Compile and Install wiki

Performance

Typical performance

Total 1000 requests.

writeseq  :    0.546 ms/op      178.7 MB/s
writerand :    0.519 ms/op      188.1 MB/s
readseq   :    0.304 ms/op      321.6 MB/s
readrand  :    0.310 ms/op      315.0 MB/s

SSDB vs Redis

Benchmark vs Redis

View full SSDB vs Redis benchmark charts...

Concurrency benchmark

========== set ==========
qps: 44251, time: 0.226 s
========== get ==========
qps: 55541, time: 0.180 s
========== del ==========
qps: 46080, time: 0.217 s
========== hset ==========
qps: 42338, time: 0.236 s
========== hget ==========
qps: 55601, time: 0.180 s
========== hdel ==========
qps: 46529, time: 0.215 s
========== zset ==========
qps: 37381, time: 0.268 s
========== zget ==========
qps: 41455, time: 0.241 s
========== zdel ==========
qps: 38792, time: 0.258 s

Run on a 2013 MacBook Pro 13 inch with Retina display.

Architecture

ssdb architecture

Windows executable

Download ssdb-server.exe from here: https://github.com/ideawu/ssdb-bin

SSDB library for iOS

make ios
# ls ios/
include/ libleveldb-ios.a libsnappy-ios.a libssdb-ios.a libutil-ios.a

Drag the static libraies files into your iOS project. Then add ios/include to your iOS project's Header Search Paths, which is set in Build Settings.

Links

Changes made to LevelDB

See Changes-Made-to-LevelDB wiki

LICENSE

SSDB is licensed under New BSD License, a very flexible license to use.

Authors

@ideawu

Thanks

ssdb's People

Contributors

ideawu avatar rockeet avatar ceyword avatar brucehuang2 avatar veklip avatar wendal avatar yanyiwu avatar sirkubax avatar ivanabc avatar so1gitworker avatar border avatar masterlvng avatar vrofze avatar reficull avatar liaochengcai avatar jiangxixin avatar 1feng avatar cnxzcxy avatar cinience avatar royguo avatar qiaomuf avatar jcai avatar ahkimkoo avatar slach avatar yegong avatar albertyou avatar

Stargazers

LinnZhang avatar ChangTai LIANG avatar  avatar  avatar  avatar PadagOne avatar liligeng avatar Zack Young avatar  avatar Shiqiang SHI avatar 6api.com avatar mang avatar

Watchers

 avatar James Cloos avatar yibozheng avatar  avatar  avatar github3a avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.