We have released Mio – a distributed Skip Graph based orderd KVS 0.0.1alpha.(mio-0.0.1-alpha.tar.gz)
What is Mio?
In short, Mio is memcached + “range search”.
Mio suports range search queries like “get 10 datum which key are between key1 and key2″.
N.B. At present, it is in alpha quality.
Building and Installing
Running Mio
# Run first node named mio1 with verbose mode on host FQDN_of_your_host (default port 11211)
% mio -v -n mio1@FQDN_of_your_host
# Run second node named mio2 on host FQDN_of_your_host2.
# With -i option, indidate the introducer node.
% mio -v -n mio2@FQDN_of_your_host2 -i mio1@FQDN_of_your_host
# Run third node named mio3 on host FQDN_of_your_host (port 11411).
% mio -v -n mio3@FQDN_of_your_host -i mio1@FQDN_of_your_host -p 11411
API
You can access to Mio using memcached protocol.
Currently the following commands are supported.
- get
- set
- delete
- quit
- stats
- range_search
get_multi(“mio:range-search”, Key1, Key2, Limit, desc/asc)
Access to mio
Use memcached client libraries to access mio.
Perl
# Example: Access to Mio.
use strict;
use warnings;
use Cache::Memcached;
use Data::Dumper;
my $m = Cache::Memcached->new( { servers => ['127.0.0.1:11211']} );
$m->set( "hello" => "world" );
$m->set( "intel" => "cpu" );
$m->set( "japan" => "Tokyo" );
warn $m->get("hello");
warn $m->get("intel");
warn $m->get("japan");
my $href = $m->get_multi("mio:range-search", "he", "j", "10", "asc");
# Should print
# $VAR1 = {
# 'hello' => 'world',
# 'intel' => 'cpu'
# };
warn Dumper $href;
PHP
$mem = new Memcached;
$mem->addServer('127.0.0.1', 11211);
$mem->set("hello", "world");
$mem->set("intel", "cpu");
$mem->set("japan", "Tokyo");
printf("%s\n", $mem->get("hello"));
printf("%s\n", $mem->get("intel"));
printf("%s\n", $mem->get("japan"));
var_dump($mem->getMulti(array("mio:range-search", "he", "j", "10", "asc")));
?>
Java
import com.danga.MemCached.*;
import java.util.*;
public class JavaMemcachedClient
{
public static void main(String[] args)
{
String[] serverlist = { "127.0.0.1:11211" };
SockIOPool pool = SockIOPool.getInstance();
pool.setServers(serverlist);
pool.initialize();
MemCachedClient mc = new MemCachedClient();
mc.set("hello", "world");
mc.set("intel", "cpu");
mc.set("japan", "Tokyo");
System.out.printf("hello => %s intel => %s japan => %s\n", mc.get("hello"), mc.get("intel"), mc.get("japan"));
String[] keys = { "mio:range-search", "he", "j", "10", "asc" };
Map<String, Object> ret = mc.getMulti(keys);
for (Map.Entry<String, Object> e : ret.entrySet()) {
System.out.println(e.getKey() + " : " + e.getValue());
}
}
}
Algorithm
Mio using “Skip Graph” algorithm. See following articles
Author
Written by Taro Minowa(Higepon) higepon@labs.cybozu.co.jp
License
New BSD License