📜 ⬆️ ⬇️

Gibson Cache Server

image In my work, I often have to use key-value storage for organizing communication between processes, storing system settings, temporary data, etc. For these purposes, I use Redis. He quite suits me, also hiredis to all libraries library.
Literally today, I came across a completely new project - Gibson Cache Server . The first commit is dated May 17, 2013. What and speech!

Gibson Cache Server is an in-memory key-value database based on a data structure — a tree, while redis and memcached use a hash table. This allows you to use operations on multiple keys at once.

Features declared by the developer:

Installation


Server

There is nothing complicated. Server sources can be found here .
git clone https://github.com/evilsocket/gibson.git cd gibson make -G «Unix Makefiles» . make sudo make install 

The configuration file is located in /etc/gibson/gibson.conf
By the way, the server can be started with the -c switch, indicating the path to the configuration file, and not installing everything in the system directories.

Customer

Sources are here .
Here, everything is the same. The only thing that should be noted in ./src/linenoise should be the source of the linenoise library.
After
 git clone https://github.com/evilsocket/libgibsonclient cd libgibsonclient make -G «Unix Makefiles» . make 

We have a “gentleman's set”: the header file, the library itself and gibson-cli.

Demonstration


Run the client and the list of commands that are available at the moment.
Hidden text
 deck@crunch ~/work/libgibsonclient $ ./gibson-cli -u /tmp/gibson.sock type :help or :h for a list of commands, :quit or :q to quit. local> :h SET <ttl> <key> <value> TLL <key> <ttl> GET <key> DEL <key> INC <key> DEC <key> LOCK <key> <seconds> UNLOCK <key> MSET <prefix> <value> MTTL <prefix> <ttl> MGET <prefix> MDEL <prefix> MINC <prefix> MDEC <prefix> MLOCK <prefix> <seconds> MUNLOCK <prefix> COUNT <prefix> STATS PING SIZEOF <key> MSIZEOF <prefix> ENCOF <key> 


Standard set / get
Hidden text
 local> set 0 foo 5 <STRING> 5 local> get foo <STRING> 5 


And using TTL.
Hidden text
 local> set 3 bar hi! <STRING> hi! local> get bar <STRING> hi! local> get bar <REPL_ERR_NOT_FOUND> 


Well, multiple get / set
Hidden text
 local> set 0 score:user1 400 <STRING> 400 local> set 0 score:user2 100 <STRING> 100 local> set 0 score:user3 900 <STRING> 900 local> mget score score:user1 => <STRING> 400 score:user2 => <STRING> 100 score:user3 => <STRING> 900 local> mset score 0 <NUMBER> 3 local> mget score score:user1 => <STRING> 0 score:user2 => <STRING> 0 score:user3 => <STRING> 0 


')

Performance


The developer’s site contains test data that he conducted on get / set operations on the machine.
Intel Core (TM) i3-2130 CPU @ 3.40GHz with 8GB of RAM, with Debian Squeeze.
He compared his database with Redis. The results are as follows:
Redis
Hidden text
 $ redis-benchmark -c 1 -n 100000 -q -t SET SET: 51519.84 requests per second $ redis-benchmark -c 1 -n 100000 -q -t GET GET: 49212.60 requests per second 


Gibson
Hidden text
 @ Created 100000 / 100000 in 1216ms -- 82236.842105 Req/s @ Verified : 100000 / 100000 in 1145ms -- 87336.244541 Req/s 


If you are not cunning, then the performance on these operations is 60 percent higher in Gibson.

Conclusion


Currently, there is already a library for php . Also, they promise to add Nodejs support soon.
The library can not be raw, but certainly deserves attention. Under my tasks should fit perfectly. Let's see what happens.

Source: https://habr.com/ru/post/185484/


All Articles