heroku-tokyotyrant 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +504 -0
- data/README.rdoc +231 -0
- data/Rakefile +72 -0
- data/benchmarks/balancer.rb +101 -0
- data/benchmarks/bulk_db.rb +74 -0
- data/benchmarks/bulk_table.rb +87 -0
- data/benchmarks/db.rb +114 -0
- data/benchmarks/table.rb +161 -0
- data/ext/extconf.rb +43 -0
- data/ext/tokyo/bin/tcamgr +0 -0
- data/ext/tokyo/bin/tcamttest +0 -0
- data/ext/tokyo/bin/tcatest +0 -0
- data/ext/tokyo/bin/tcbmgr +0 -0
- data/ext/tokyo/bin/tcbmttest +0 -0
- data/ext/tokyo/bin/tcbtest +0 -0
- data/ext/tokyo/bin/tcfmgr +0 -0
- data/ext/tokyo/bin/tcfmttest +0 -0
- data/ext/tokyo/bin/tcftest +0 -0
- data/ext/tokyo/bin/tchmgr +0 -0
- data/ext/tokyo/bin/tchmttest +0 -0
- data/ext/tokyo/bin/tchtest +0 -0
- data/ext/tokyo/bin/tcrmgr +0 -0
- data/ext/tokyo/bin/tcrmttest +0 -0
- data/ext/tokyo/bin/tcrtest +0 -0
- data/ext/tokyo/bin/tctmgr +0 -0
- data/ext/tokyo/bin/tctmttest +0 -0
- data/ext/tokyo/bin/tcttest +0 -0
- data/ext/tokyo/bin/tcucodec +0 -0
- data/ext/tokyo/bin/tcumttest +0 -0
- data/ext/tokyo/bin/tcutest +0 -0
- data/ext/tokyo/bin/ttserver +0 -0
- data/ext/tokyo/bin/ttulmgr +0 -0
- data/ext/tokyo/bin/ttultest +0 -0
- data/ext/tokyo/include/tcadb.h +548 -0
- data/ext/tokyo/include/tcbdb.h +1101 -0
- data/ext/tokyo/include/tcfdb.h +858 -0
- data/ext/tokyo/include/tchdb.h +871 -0
- data/ext/tokyo/include/tcrdb.h +801 -0
- data/ext/tokyo/include/tctdb.h +1086 -0
- data/ext/tokyo/include/tculog.h +392 -0
- data/ext/tokyo/include/tcutil.h +4184 -0
- data/ext/tokyo/include/ttutil.h +494 -0
- data/ext/tokyo/lib/libtokyocabinet.9.4.0.dylib +0 -0
- data/ext/tokyo/lib/libtokyocabinet.9.dylib +0 -0
- data/ext/tokyo/lib/libtokyocabinet.a +0 -0
- data/ext/tokyo/lib/libtokyocabinet.dylib +0 -0
- data/ext/tokyo/lib/libtokyotyrant.3.22.0.dylib +0 -0
- data/ext/tokyo/lib/libtokyotyrant.3.dylib +0 -0
- data/ext/tokyo/lib/libtokyotyrant.a +0 -0
- data/ext/tokyo/lib/libtokyotyrant.dylib +0 -0
- data/ext/tokyo/lib/pkgconfig/tokyocabinet.pc +14 -0
- data/ext/tokyo/lib/pkgconfig/tokyotyrant.pc +14 -0
- data/ext/tokyo/lib/ttskeldir.bundle +0 -0
- data/ext/tokyo/lib/ttskelmock.bundle +0 -0
- data/ext/tokyo/lib/ttskelnull.bundle +0 -0
- data/ext/tokyo/lib/ttskelproxy.bundle +0 -0
- data/ext/tokyo/libexec/tcawmgr.cgi +0 -0
- data/ext/tokyo/sbin/ttservctl +163 -0
- data/ext/tokyo/share/man/man1/tcamgr.1 +97 -0
- data/ext/tokyo/share/man/man1/tcamttest.1 +35 -0
- data/ext/tokyo/share/man/man1/tcatest.1 +55 -0
- data/ext/tokyo/share/man/man1/tcbmgr.1 +125 -0
- data/ext/tokyo/share/man/man1/tcbmttest.1 +81 -0
- data/ext/tokyo/share/man/man1/tcbtest.1 +107 -0
- data/ext/tokyo/share/man/man1/tcfmgr.1 +98 -0
- data/ext/tokyo/share/man/man1/tcfmttest.1 +62 -0
- data/ext/tokyo/share/man/man1/tcftest.1 +73 -0
- data/ext/tokyo/share/man/man1/tchmgr.1 +110 -0
- data/ext/tokyo/share/man/man1/tchmttest.1 +85 -0
- data/ext/tokyo/share/man/man1/tchtest.1 +95 -0
- data/ext/tokyo/share/man/man1/tcrmgr.1 +164 -0
- data/ext/tokyo/share/man/man1/tcrmttest.1 +55 -0
- data/ext/tokyo/share/man/man1/tcrtest.1 +89 -0
- data/ext/tokyo/share/man/man1/tctmgr.1 +140 -0
- data/ext/tokyo/share/man/man1/tctmttest.1 +92 -0
- data/ext/tokyo/share/man/man1/tcttest.1 +105 -0
- data/ext/tokyo/share/man/man1/tcucodec.1 +162 -0
- data/ext/tokyo/share/man/man1/tcumttest.1 +41 -0
- data/ext/tokyo/share/man/man1/tcutest.1 +81 -0
- data/ext/tokyo/share/man/man1/ttserver.1 +84 -0
- data/ext/tokyo/share/man/man1/ttulmgr.1 +40 -0
- data/ext/tokyo/share/man/man1/ttultest.1 +16 -0
- data/ext/tokyo/share/man/man3/tcadb.3 +676 -0
- data/ext/tokyo/share/man/man3/tcbdb.3 +1355 -0
- data/ext/tokyo/share/man/man3/tcfdb.3 +975 -0
- data/ext/tokyo/share/man/man3/tchdb.3 +898 -0
- data/ext/tokyo/share/man/man3/tclist.3 +1 -0
- data/ext/tokyo/share/man/man3/tcmap.3 +1 -0
- data/ext/tokyo/share/man/man3/tcmdb.3 +1 -0
- data/ext/tokyo/share/man/man3/tcmpool.3 +1 -0
- data/ext/tokyo/share/man/man3/tcrdb.3 +1309 -0
- data/ext/tokyo/share/man/man3/tctdb.3 +1110 -0
- data/ext/tokyo/share/man/man3/tctree.3 +1 -0
- data/ext/tokyo/share/man/man3/tculog.3 +15 -0
- data/ext/tokyo/share/man/man3/tcutil.3 +4518 -0
- data/ext/tokyo/share/man/man3/tcxstr.3 +1 -0
- data/ext/tokyo/share/man/man3/tokyocabinet.3 +132 -0
- data/ext/tokyo/share/man/man3/ttutil.3 +14 -0
- data/ext/tokyo/share/man/man8/ttservctl.8 +37 -0
- data/ext/tokyo/share/tokyocabinet/COPYING +504 -0
- data/ext/tokyo/share/tokyocabinet/ChangeLog +1252 -0
- data/ext/tokyo/share/tokyocabinet/THANKS +12 -0
- data/ext/tokyo/share/tokyocabinet/doc/benchmark.pdf +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/common.css +211 -0
- data/ext/tokyo/share/tokyocabinet/doc/icon16.png +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/index.html +156 -0
- data/ext/tokyo/share/tokyocabinet/doc/index.ja.html +197 -0
- data/ext/tokyo/share/tokyocabinet/doc/logo-ja.png +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/logo.png +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/spex-en.html +7145 -0
- data/ext/tokyo/share/tokyocabinet/doc/spex-ja.html +7476 -0
- data/ext/tokyo/share/tokyocabinet/doc/tokyoproducts.pdf +0 -0
- data/ext/tokyo/share/tokyocabinet/doc/tokyoproducts.ppt +0 -0
- data/ext/tokyo/share/tokyotyrant/COPYING +504 -0
- data/ext/tokyo/share/tokyotyrant/ChangeLog +578 -0
- data/ext/tokyo/share/tokyotyrant/THANKS +15 -0
- data/ext/tokyo/share/tokyotyrant/doc/common.css +211 -0
- data/ext/tokyo/share/tokyotyrant/doc/index.html +79 -0
- data/ext/tokyo/share/tokyotyrant/doc/spex.html +2264 -0
- data/ext/tokyo/share/tokyotyrant/ext/mapreduce.lua +57 -0
- data/ext/tokyo/share/tokyotyrant/ext/queue.lua +55 -0
- data/ext/tokyo/share/tokyotyrant/ext/senatus.lua +532 -0
- data/ext/tokyo/share/tokyotyrant/ext/usherette.lua +438 -0
- data/ext/tokyo_tyrant.c +147 -0
- data/ext/tokyo_tyrant.h +48 -0
- data/ext/tokyo_tyrant_db.c +227 -0
- data/ext/tokyo_tyrant_db.h +8 -0
- data/ext/tokyo_tyrant_module.c +453 -0
- data/ext/tokyo_tyrant_module.h +10 -0
- data/ext/tokyo_tyrant_query.c +226 -0
- data/ext/tokyo_tyrant_query.h +9 -0
- data/ext/tokyo_tyrant_table.c +319 -0
- data/ext/tokyo_tyrant_table.h +8 -0
- data/ext/tokyocabinet-1.4.41/COPYING +504 -0
- data/ext/tokyocabinet-1.4.41/ChangeLog +1252 -0
- data/ext/tokyocabinet-1.4.41/Makefile.in +825 -0
- data/ext/tokyocabinet-1.4.41/README +38 -0
- data/ext/tokyocabinet-1.4.41/THANKS +12 -0
- data/ext/tokyocabinet-1.4.41/bros/Makefile +133 -0
- data/ext/tokyocabinet-1.4.41/bros/bdbtest.c +438 -0
- data/ext/tokyocabinet-1.4.41/bros/cdbtest.c +219 -0
- data/ext/tokyocabinet-1.4.41/bros/cmpsqltctest.c +186 -0
- data/ext/tokyocabinet-1.4.41/bros/gdbmtest.c +216 -0
- data/ext/tokyocabinet-1.4.41/bros/mapreporter +72 -0
- data/ext/tokyocabinet-1.4.41/bros/maptest.cc +677 -0
- data/ext/tokyocabinet-1.4.41/bros/ndbmtest.c +204 -0
- data/ext/tokyocabinet-1.4.41/bros/qdbmtest.c +375 -0
- data/ext/tokyocabinet-1.4.41/bros/reporter +141 -0
- data/ext/tokyocabinet-1.4.41/bros/result.xls +0 -0
- data/ext/tokyocabinet-1.4.41/bros/sdbmtest.c +204 -0
- data/ext/tokyocabinet-1.4.41/bros/sqltest.c +404 -0
- data/ext/tokyocabinet-1.4.41/bros/tctest.c +748 -0
- data/ext/tokyocabinet-1.4.41/bros/tdbtest.c +205 -0
- data/ext/tokyocabinet-1.4.41/configure +7402 -0
- data/ext/tokyocabinet-1.4.41/configure.in +362 -0
- data/ext/tokyocabinet-1.4.41/doc/benchmark.pdf +0 -0
- data/ext/tokyocabinet-1.4.41/doc/common.css +211 -0
- data/ext/tokyocabinet-1.4.41/doc/icon16.png +0 -0
- data/ext/tokyocabinet-1.4.41/doc/index.html +156 -0
- data/ext/tokyocabinet-1.4.41/doc/index.ja.html +197 -0
- data/ext/tokyocabinet-1.4.41/doc/logo-ja.png +0 -0
- data/ext/tokyocabinet-1.4.41/doc/logo.png +0 -0
- data/ext/tokyocabinet-1.4.41/doc/spex-en.html +7145 -0
- data/ext/tokyocabinet-1.4.41/doc/spex-ja.html +7476 -0
- data/ext/tokyocabinet-1.4.41/doc/tokyoproducts.pdf +0 -0
- data/ext/tokyocabinet-1.4.41/doc/tokyoproducts.ppt +0 -0
- data/ext/tokyocabinet-1.4.41/example/Makefile +113 -0
- data/ext/tokyocabinet-1.4.41/example/tcadbex.c +55 -0
- data/ext/tokyocabinet-1.4.41/example/tcbdbex.c +64 -0
- data/ext/tokyocabinet-1.4.41/example/tcfdbex.c +60 -0
- data/ext/tokyocabinet-1.4.41/example/tchdbex.c +60 -0
- data/ext/tokyocabinet-1.4.41/example/tctchat.c +97 -0
- data/ext/tokyocabinet-1.4.41/example/tctchat.tmpl +141 -0
- data/ext/tokyocabinet-1.4.41/example/tctdbex.c +85 -0
- data/ext/tokyocabinet-1.4.41/example/tctsearch.c +95 -0
- data/ext/tokyocabinet-1.4.41/example/tctsearch.tmpl +122 -0
- data/ext/tokyocabinet-1.4.41/example/tcutilex.c +77 -0
- data/ext/tokyocabinet-1.4.41/f.tsv +2 -0
- data/ext/tokyocabinet-1.4.41/lab/calccomp +118 -0
- data/ext/tokyocabinet-1.4.41/lab/datechange +56 -0
- data/ext/tokyocabinet-1.4.41/lab/diffcheck +45 -0
- data/ext/tokyocabinet-1.4.41/lab/htmltotsv +102 -0
- data/ext/tokyocabinet-1.4.41/lab/magic +19 -0
- data/ext/tokyocabinet-1.4.41/lab/printenv.cgi +27 -0
- data/ext/tokyocabinet-1.4.41/lab/stepcount +26 -0
- data/ext/tokyocabinet-1.4.41/lab/stopwatch +61 -0
- data/ext/tokyocabinet-1.4.41/lab/tabcheck +43 -0
- data/ext/tokyocabinet-1.4.41/lab/wgettsv +239 -0
- data/ext/tokyocabinet-1.4.41/lab/widthcheck +57 -0
- data/ext/tokyocabinet-1.4.41/man/htmltoman +104 -0
- data/ext/tokyocabinet-1.4.41/man/tcadb.3 +676 -0
- data/ext/tokyocabinet-1.4.41/man/tcamgr.1 +97 -0
- data/ext/tokyocabinet-1.4.41/man/tcamttest.1 +35 -0
- data/ext/tokyocabinet-1.4.41/man/tcatest.1 +55 -0
- data/ext/tokyocabinet-1.4.41/man/tcbdb.3 +1355 -0
- data/ext/tokyocabinet-1.4.41/man/tcbmgr.1 +125 -0
- data/ext/tokyocabinet-1.4.41/man/tcbmttest.1 +81 -0
- data/ext/tokyocabinet-1.4.41/man/tcbtest.1 +107 -0
- data/ext/tokyocabinet-1.4.41/man/tcfdb.3 +975 -0
- data/ext/tokyocabinet-1.4.41/man/tcfmgr.1 +98 -0
- data/ext/tokyocabinet-1.4.41/man/tcfmttest.1 +62 -0
- data/ext/tokyocabinet-1.4.41/man/tcftest.1 +73 -0
- data/ext/tokyocabinet-1.4.41/man/tchdb.3 +898 -0
- data/ext/tokyocabinet-1.4.41/man/tchmgr.1 +110 -0
- data/ext/tokyocabinet-1.4.41/man/tchmttest.1 +85 -0
- data/ext/tokyocabinet-1.4.41/man/tchtest.1 +95 -0
- data/ext/tokyocabinet-1.4.41/man/tclist.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tcmap.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tcmdb.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tcmpool.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tctdb.3 +1110 -0
- data/ext/tokyocabinet-1.4.41/man/tctmgr.1 +140 -0
- data/ext/tokyocabinet-1.4.41/man/tctmttest.1 +92 -0
- data/ext/tokyocabinet-1.4.41/man/tctree.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tcttest.1 +105 -0
- data/ext/tokyocabinet-1.4.41/man/tcucodec.1 +162 -0
- data/ext/tokyocabinet-1.4.41/man/tcumttest.1 +41 -0
- data/ext/tokyocabinet-1.4.41/man/tcutest.1 +81 -0
- data/ext/tokyocabinet-1.4.41/man/tcutil.3 +4518 -0
- data/ext/tokyocabinet-1.4.41/man/tcxstr.3 +1 -0
- data/ext/tokyocabinet-1.4.41/man/tokyocabinet.3 +132 -0
- data/ext/tokyocabinet-1.4.41/md5.c +381 -0
- data/ext/tokyocabinet-1.4.41/md5.h +101 -0
- data/ext/tokyocabinet-1.4.41/myconf.c +493 -0
- data/ext/tokyocabinet-1.4.41/myconf.h +549 -0
- data/ext/tokyocabinet-1.4.41/tcadb.c +4339 -0
- data/ext/tokyocabinet-1.4.41/tcadb.h +548 -0
- data/ext/tokyocabinet-1.4.41/tcamgr.c +1019 -0
- data/ext/tokyocabinet-1.4.41/tcamttest.c +542 -0
- data/ext/tokyocabinet-1.4.41/tcatest.c +1845 -0
- data/ext/tokyocabinet-1.4.41/tcawmgr.c +482 -0
- data/ext/tokyocabinet-1.4.41/tcbdb.c +4180 -0
- data/ext/tokyocabinet-1.4.41/tcbdb.h +1101 -0
- data/ext/tokyocabinet-1.4.41/tcbmgr.c +1012 -0
- data/ext/tokyocabinet-1.4.41/tcbmttest.c +1810 -0
- data/ext/tokyocabinet-1.4.41/tcbtest.c +2586 -0
- data/ext/tokyocabinet-1.4.41/tcfdb.c +2746 -0
- data/ext/tokyocabinet-1.4.41/tcfdb.h +858 -0
- data/ext/tokyocabinet-1.4.41/tcfmgr.c +786 -0
- data/ext/tokyocabinet-1.4.41/tcfmttest.c +1220 -0
- data/ext/tokyocabinet-1.4.41/tcftest.c +1695 -0
- data/ext/tokyocabinet-1.4.41/tchdb.c +5153 -0
- data/ext/tokyocabinet-1.4.41/tchdb.h +871 -0
- data/ext/tokyocabinet-1.4.41/tchmgr.c +842 -0
- data/ext/tokyocabinet-1.4.41/tchmttest.c +1757 -0
- data/ext/tokyocabinet-1.4.41/tchtest.c +2129 -0
- data/ext/tokyocabinet-1.4.41/tctdb.c +6199 -0
- data/ext/tokyocabinet-1.4.41/tctdb.h +1086 -0
- data/ext/tokyocabinet-1.4.41/tctmgr.c +1241 -0
- data/ext/tokyocabinet-1.4.41/tctmttest.c +1563 -0
- data/ext/tokyocabinet-1.4.41/tcttest.c +2062 -0
- data/ext/tokyocabinet-1.4.41/tcucodec.c +1357 -0
- data/ext/tokyocabinet-1.4.41/tcumttest.c +578 -0
- data/ext/tokyocabinet-1.4.41/tcutest.c +1875 -0
- data/ext/tokyocabinet-1.4.41/tcutil.c +10528 -0
- data/ext/tokyocabinet-1.4.41/tcutil.h +4184 -0
- data/ext/tokyocabinet-1.4.41/tokyocabinet.idl +336 -0
- data/ext/tokyocabinet-1.4.41/tokyocabinet.pc.in +14 -0
- data/ext/tokyotyrant-1.1.39/COPYING +504 -0
- data/ext/tokyotyrant-1.1.39/ChangeLog +578 -0
- data/ext/tokyotyrant-1.1.39/Makefile.in +365 -0
- data/ext/tokyotyrant-1.1.39/README +38 -0
- data/ext/tokyotyrant-1.1.39/THANKS +15 -0
- data/ext/tokyotyrant-1.1.39/configure +6979 -0
- data/ext/tokyotyrant-1.1.39/configure.in +300 -0
- data/ext/tokyotyrant-1.1.39/doc/common.css +211 -0
- data/ext/tokyotyrant-1.1.39/doc/index.html +79 -0
- data/ext/tokyotyrant-1.1.39/doc/spex.html +2264 -0
- data/ext/tokyotyrant-1.1.39/example/Makefile +68 -0
- data/ext/tokyotyrant-1.1.39/example/httptest.pl +88 -0
- data/ext/tokyotyrant-1.1.39/example/mcftest.pl +39 -0
- data/ext/tokyotyrant-1.1.39/example/mctest.pl +43 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbex +0 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbex.c +49 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbex.o +0 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbtblex +0 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbtblex.c +79 -0
- data/ext/tokyotyrant-1.1.39/example/tcrdbtblex.o +0 -0
- data/ext/tokyotyrant-1.1.39/ext/mapreduce.lua +57 -0
- data/ext/tokyotyrant-1.1.39/ext/queue.lua +55 -0
- data/ext/tokyotyrant-1.1.39/ext/senatus.lua +532 -0
- data/ext/tokyotyrant-1.1.39/ext/usherette.lua +438 -0
- data/ext/tokyotyrant-1.1.39/lab/datechange +56 -0
- data/ext/tokyotyrant-1.1.39/lab/diffcheck +45 -0
- data/ext/tokyotyrant-1.1.39/lab/fibonacci.lua +20 -0
- data/ext/tokyotyrant-1.1.39/lab/footprint.lua +67 -0
- data/ext/tokyotyrant-1.1.39/lab/highlow.lua +88 -0
- data/ext/tokyotyrant-1.1.39/lab/killdualmaster +12 -0
- data/ext/tokyotyrant-1.1.39/lab/rundualmaster +38 -0
- data/ext/tokyotyrant-1.1.39/lab/stepcount +26 -0
- data/ext/tokyotyrant-1.1.39/lab/tabcheck +43 -0
- data/ext/tokyotyrant-1.1.39/lab/ushrtregister.pl +55 -0
- data/ext/tokyotyrant-1.1.39/lab/widthcheck +57 -0
- data/ext/tokyotyrant-1.1.39/man/htmltoman +100 -0
- data/ext/tokyotyrant-1.1.39/man/tcrdb.3 +1309 -0
- data/ext/tokyotyrant-1.1.39/man/tcrmgr.1 +164 -0
- data/ext/tokyotyrant-1.1.39/man/tcrmttest.1 +55 -0
- data/ext/tokyotyrant-1.1.39/man/tcrtest.1 +89 -0
- data/ext/tokyotyrant-1.1.39/man/tculog.3 +15 -0
- data/ext/tokyotyrant-1.1.39/man/ttservctl.8 +37 -0
- data/ext/tokyotyrant-1.1.39/man/ttserver.1 +84 -0
- data/ext/tokyotyrant-1.1.39/man/ttulmgr.1 +40 -0
- data/ext/tokyotyrant-1.1.39/man/ttultest.1 +16 -0
- data/ext/tokyotyrant-1.1.39/man/ttutil.3 +14 -0
- data/ext/tokyotyrant-1.1.39/myconf.c +169 -0
- data/ext/tokyotyrant-1.1.39/myconf.h +408 -0
- data/ext/tokyotyrant-1.1.39/scrext.c +2394 -0
- data/ext/tokyotyrant-1.1.39/scrext.h +96 -0
- data/ext/tokyotyrant-1.1.39/tcrdb.c +2637 -0
- data/ext/tokyotyrant-1.1.39/tcrdb.h +801 -0
- data/ext/tokyotyrant-1.1.39/tcrmgr.c +1559 -0
- data/ext/tokyotyrant-1.1.39/tcrmttest.c +915 -0
- data/ext/tokyotyrant-1.1.39/tcrtest.c +1542 -0
- data/ext/tokyotyrant-1.1.39/tculog.c +1211 -0
- data/ext/tokyotyrant-1.1.39/tculog.h +392 -0
- data/ext/tokyotyrant-1.1.39/tokyotyrant.idl +143 -0
- data/ext/tokyotyrant-1.1.39/tokyotyrant.pc.in +14 -0
- data/ext/tokyotyrant-1.1.39/ttservctl +163 -0
- data/ext/tokyotyrant-1.1.39/ttserver.c +3583 -0
- data/ext/tokyotyrant-1.1.39/ttskeldir.c +141 -0
- data/ext/tokyotyrant-1.1.39/ttskelmock.c +64 -0
- data/ext/tokyotyrant-1.1.39/ttskelnull.c +79 -0
- data/ext/tokyotyrant-1.1.39/ttskelproxy.c +74 -0
- data/ext/tokyotyrant-1.1.39/ttulmgr.c +266 -0
- data/ext/tokyotyrant-1.1.39/ttultest.c +371 -0
- data/ext/tokyotyrant-1.1.39/ttutil.c +1510 -0
- data/ext/tokyotyrant-1.1.39/ttutil.h +494 -0
- data/lib/tokyo_tyrant/balancer.rb +189 -0
- data/spec/ext.lua +4 -0
- data/spec/plu_db.rb +538 -0
- data/spec/spec.rb +1 -0
- data/spec/spec_base.rb +17 -0
- data/spec/start_tyrants.sh +36 -0
- data/spec/stop_tyrants.sh +9 -0
- data/spec/tokyo_tyrant_balancer_db_spec.rb +160 -0
- data/spec/tokyo_tyrant_balancer_table_spec.rb +177 -0
- data/spec/tokyo_tyrant_query_spec.rb +159 -0
- data/spec/tokyo_tyrant_spec.rb +254 -0
- data/spec/tokyo_tyrant_table_spec.rb +301 -0
- metadata +402 -0
data/README.rdoc
ADDED
@@ -0,0 +1,231 @@
|
|
1
|
+
= TokyoTyrant Ruby Client
|
2
|
+
|
3
|
+
This is a c extension for Ruby to access TokyoTyrant databases. It currently supports key/value, table databases and table queries.
|
4
|
+
|
5
|
+
== Install
|
6
|
+
|
7
|
+
# install tokyocabinet (1.4.34) and tokyotyrant (requires 1.1.35)
|
8
|
+
# after installing tc and tt on linux I had to /sbin/ldconfig (as root)
|
9
|
+
sudo gem install gemcutter
|
10
|
+
sudo gem tumble
|
11
|
+
sudo gem install ruby-tokyotyrant
|
12
|
+
|
13
|
+
== Performance
|
14
|
+
|
15
|
+
This is not in production but the initial benchmarks are very interesting. Results look closer to the memcached gem than any other tyrant client I've seen for Ruby.
|
16
|
+
|
17
|
+
* Key/Value Store: http://gist.github.com/75212
|
18
|
+
* Table Store: http://gist.github.com/74116
|
19
|
+
* Bulk Operations: http://gist.github.com/83194
|
20
|
+
* Bulk Table Operations: http://gist.github.com/87215
|
21
|
+
|
22
|
+
== Example
|
23
|
+
|
24
|
+
=== Hash DB
|
25
|
+
|
26
|
+
# start tyrant like so:
|
27
|
+
# ttserver example.tch
|
28
|
+
|
29
|
+
require 'tokyo_tyrant'
|
30
|
+
db = TokyoTyrant::DB.new('127.0.0.1', 1978)
|
31
|
+
|
32
|
+
db['foo'] = 'Bar' # => "Bar"
|
33
|
+
db['foo'] # => "Bar"
|
34
|
+
|
35
|
+
db.each{ |k,v| puts [k, v].inspect }
|
36
|
+
# ["foo", "Bar"]
|
37
|
+
# => nil
|
38
|
+
|
39
|
+
db.mput("1"=>"number_1", "2"=>"number_2", "3"=>"number_3", "4"=>"number_4", "5"=>"number_5")
|
40
|
+
db.mget(1..3) # => {"1"=>"number_1", "2"=>"number_2", "3"=>"number_3"}
|
41
|
+
|
42
|
+
=== Table DB
|
43
|
+
|
44
|
+
# start tyrant like so:
|
45
|
+
# ttserver example.tct
|
46
|
+
|
47
|
+
require 'tokyo_tyrant'
|
48
|
+
t = TokyoTyrant::Table.new('127.0.0.1', 1978)
|
49
|
+
|
50
|
+
t['bar'] = { :baz => 'box' } # => { :baz => 'box' }
|
51
|
+
t['bar'] # => { :baz => 'box' }
|
52
|
+
|
53
|
+
t.each{ |k,v| puts [k, v].inspect }
|
54
|
+
# ["bar", {:baz=>"box"}]
|
55
|
+
# => nil
|
56
|
+
|
57
|
+
# bulk operations
|
58
|
+
h = {}
|
59
|
+
100.times do |i|
|
60
|
+
h[i] = { :name => 'Pat', :sex => i % 2 > 0 ? 'male' : 'female' }
|
61
|
+
end
|
62
|
+
t.mput(h)
|
63
|
+
t.mget(0..3)
|
64
|
+
# => {"0"=>{:name=>"Pat", :sex=>"female"}, "1"=>{:name=>"Pat", :sex=>"male"}, "2"=>{:name=>"Pat", :sex=>"female"}, "3"=>{:name=>"Pat", :sex=>"male"}}
|
65
|
+
|
66
|
+
=== Table Query
|
67
|
+
|
68
|
+
require 'tokyo_tyrant'
|
69
|
+
t = TokyoTyrant::Table.new('127.0.0.1', 1978)
|
70
|
+
|
71
|
+
100.times do |i|
|
72
|
+
t[i] = { 'name' => "Pat #{i}", 'sex' => i % 2 > 0 ? 'male' : 'female' }
|
73
|
+
end
|
74
|
+
|
75
|
+
q = t.query
|
76
|
+
q.condition('sex', :streq, 'male')
|
77
|
+
q.limit(5)
|
78
|
+
# Get a list of IDs
|
79
|
+
ids = q.search
|
80
|
+
# => ["1", "3", "5", "7", "9"]
|
81
|
+
q.order_by(:name, :strdesc)
|
82
|
+
ids = q.search
|
83
|
+
# => ["99", "97", "95", "93", "91"]
|
84
|
+
# Get the actual records
|
85
|
+
q.get
|
86
|
+
# => [{:__id=>"99", :sex=>"male", :name=>"Pat 99"}, {:__id=>"97", :sex=>"male", :name=>"Pat 97"}, {:__id=>"95", :sex=>"male", :name=>"Pat 95"}, {:__id=>"93", :sex=>"male", :name=>"Pat 93"}, {:__id=>"91", :sex=>"male", :name=>"Pat 91"}]
|
87
|
+
|
88
|
+
# Alternative Syntax (better)
|
89
|
+
|
90
|
+
# Query using a block
|
91
|
+
t.query{ |q|
|
92
|
+
q.condition('sex', :streq, 'male')
|
93
|
+
q.limit(5)
|
94
|
+
}
|
95
|
+
# => ["1", "3", "5", "7", "9"]
|
96
|
+
|
97
|
+
# Get records for a query
|
98
|
+
t.find{ |q|
|
99
|
+
q.condition('sex', :streq, 'male')
|
100
|
+
q.limit(5)
|
101
|
+
}
|
102
|
+
# => [{:sex=>"male", :name=>"Pat 1", :__id=>"1"}, {:sex=>"male", :name=>"Pat 3", :__id=>"3"}, {:sex=>"male", :name=>"Pat 5", :__id=>"5"}, {:sex=>"male", :name=>"Pat 7", :__id=>"7"}, {:sex=>"male", :name=>"Pat 9", :__id=>"9"}]
|
103
|
+
|
104
|
+
# Prepare but don't run a search, return a prepared query object
|
105
|
+
q = t.prepare_query{ |q|
|
106
|
+
q.condition('sex', :streq, 'male')
|
107
|
+
q.limit(5)
|
108
|
+
}
|
109
|
+
# => #<TokyoTyrant::Query:0x247c14 @rdb=#<Object:0x2800a0>, @rdbquery=#<Object:0x247c00>>
|
110
|
+
q.search
|
111
|
+
# => ["1", "3", "5", "7", "9"]
|
112
|
+
q.get
|
113
|
+
# => [{:sex=>"male", :name=>"Pat 1", :__id=>"1"}, {:sex=>"male", :name=>"Pat 3", :__id=>"3"}, {:sex=>"male", :name=>"Pat 5", :__id=>"5"}, {:sex=>"male", :name=>"Pat 7", :__id=>"7"}, {:sex=>"male", :name=>"Pat 9", :__id=>"9"}]
|
114
|
+
|
115
|
+
=== Full Text Search
|
116
|
+
|
117
|
+
require 'tokyo_tyrant'
|
118
|
+
require 'nokogiri'
|
119
|
+
require 'open-uri'
|
120
|
+
|
121
|
+
t = TokyoTyrant::Table.new('127.0.0.1', 1978)
|
122
|
+
|
123
|
+
(1..13).each do |n|
|
124
|
+
doc = Nokogiri::HTML(open("http://www.sacred-texts.com/chr/herm/hermes#{n}.htm"))
|
125
|
+
chapter = doc.css('h2').last.inner_text.gsub(/\n/, '').gsub(/ +/, ' ').strip
|
126
|
+
doc.css('p').each_with_index do |paragraph, i|
|
127
|
+
paragraph = paragraph.inner_text.gsub(/\n/, '').gsub(/ +/, ' ').strip
|
128
|
+
key = "chapter:#{n}:paragraph:#{i+1}"
|
129
|
+
t[key] = { :chapter => chapter, :paragraph => paragraph }
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# full-text search with the phrase of
|
134
|
+
t.query{ |q| q.condition(:paragraph, :fts, 'rebirth') }
|
135
|
+
# => ["chapter:13:paragraph:4", "chapter:13:paragraph:5", "chapter:13:paragraph:7", "chapter:13:paragraph:19", "chapter:13:paragraph:27", "chapter:13:paragraph:44", "chapter:13:paragraph:57", "chapter:13:paragraph:69", "chapter:13:paragraph:125"]
|
136
|
+
|
137
|
+
# full-text search with all tokens in
|
138
|
+
t.query{ |q| q.condition(:paragraph, :ftsand, 'logos word') }
|
139
|
+
# => ["chapter:1:paragraph:12", "chapter:1:paragraph:14", "chapter:1:paragraph:17", "chapter:1:paragraph:19", "chapter:1:paragraph:24", "chapter:1:paragraph:27", "chapter:1:paragraph:43", "chapter:1:paragraph:53", "... lots more ..."]
|
140
|
+
|
141
|
+
# full-text search with at least one token in
|
142
|
+
t.query{ |q| q.condition(:paragraph, :ftsor, 'sermon key') }
|
143
|
+
# => ["chapter:5:paragraph:1", "chapter:9:paragraph:3", "chapter:10:paragraph:1", "chapter:10:paragraph:4", "chapter:10:paragraph:28", "chapter:11:paragraph:3", "chapter:11:paragraph:66", "chapter:11:paragraph:69", "... lots more ..."]
|
144
|
+
|
145
|
+
# negated full-text search with at least one token in
|
146
|
+
t.query{ |q| q.condition(:paragraph, '!ftsor', 'the god he and I that said') }
|
147
|
+
# => ["chapter:1:paragraph:95", "chapter:1:paragraph:96", "chapter:1:paragraph:97", "chapter:1:paragraph:98", "chapter:1:paragraph:99", "chapter:2:paragraph:3", "chapter:2:paragraph:5", "chapter:2:paragraph:6", "... lots more ..."]
|
148
|
+
|
149
|
+
==== Meta Search (Multi Query)
|
150
|
+
|
151
|
+
query1 = t.prepare_query{ |q| q.condition(:paragraph, :fts, 'rebirth') }
|
152
|
+
query2 = t.prepare_query{ |q| q.condition(:paragraph, :fts, 'logos') }
|
153
|
+
|
154
|
+
# Get the union of two query sets (OR)
|
155
|
+
t.search(:union, query1, query2)
|
156
|
+
# => ["chapter:13:paragraph:4", "chapter:13:paragraph:5", "chapter:13:paragraph:7", "chapter:13:paragraph:19", "chapter:13:paragraph:27", "chapter:13:paragraph:44", "chapter:13:paragraph:57", "... lots more ..."]
|
157
|
+
|
158
|
+
# Get the intersection of two query sets (AND)
|
159
|
+
t.search(:intersection, query1, query2)
|
160
|
+
# => ["chapter:13:paragraph:5", "chapter:13:paragraph:44", "chapter:13:paragraph:69"]
|
161
|
+
|
162
|
+
# Get the difference of two query sets (ANDNOT)
|
163
|
+
t.search(:diff, query1, query2)
|
164
|
+
# => ["chapter:13:paragraph:4", "chapter:13:paragraph:7", "chapter:13:paragraph:19", "chapter:13:paragraph:27", "chapter:13:paragraph:57", "chapter:13:paragraph:125"]
|
165
|
+
|
166
|
+
=== Parallel Querying (Take that scalability!)
|
167
|
+
|
168
|
+
require 'tokyo_tyrant'
|
169
|
+
require 'faker'
|
170
|
+
tyrants = { 1 => TokyoTyrant::Table.new('127.0.0.1', 1978),
|
171
|
+
2 => TokyoTyrant::Table.new('127.0.0.1', 1979) }
|
172
|
+
|
173
|
+
# dummy data
|
174
|
+
tyrants.each{ |account_id, table|
|
175
|
+
table.clear
|
176
|
+
20.times do |i|
|
177
|
+
table["#{account_id}/#{i}"] = { # consistent hashing would be good here
|
178
|
+
:name => Faker::Company.name,
|
179
|
+
:plan => rand(3),
|
180
|
+
}
|
181
|
+
end
|
182
|
+
}
|
183
|
+
|
184
|
+
queries = tyrants.collect{ |account_id, table|
|
185
|
+
table.prepare_query{ |q| q.condition 'plan', :numlt, '1' }
|
186
|
+
}
|
187
|
+
|
188
|
+
TokyoTyrant::Query.parallel_search(*queries).collect{ |r| {r[""] => r["name"]} }
|
189
|
+
# => [{"1/3"=>"Zemlak-Jerde"}, {"1/6"=>"O'Conner-Batz"}, {"1/9"=>"Kutch, Erdman and Aufderhar"}, {"1/11"=>"Bartoletti, Armstrong and Barrows"}, {"1/12"=>"Ferry-Dicki"}, {"2/0"=>"Schultz-O'Hara"}, {"2/1"=>"Emmerich, Feest and Huels"}, {"2/2"=>"Borer and Sons"}, {"2/3"=>"D'Amore Inc"}, {"2/5"=>"Koch and Sons"}, {"2/8"=>"Schaefer Group"}, {"2/11"=>"Stroman, Toy and Abernathy"}, {"2/19"=>"Gaylord, Reinger and White"}]
|
190
|
+
|
191
|
+
=== Lua Extension
|
192
|
+
|
193
|
+
# ttserver -ext spec/ext.lua
|
194
|
+
require 'tokyo_tyrant'
|
195
|
+
t = TokyoTyrant::Table.new('127.0.0.1', 1978)
|
196
|
+
|
197
|
+
t.run(:echo, 'hello', 'world')
|
198
|
+
# => "hello\tworld"
|
199
|
+
|
200
|
+
=== Balanced Nodes with Consistent Hashing
|
201
|
+
|
202
|
+
# usage is similar to single node
|
203
|
+
require 'tokyo_tyrant/balancer'
|
204
|
+
|
205
|
+
servers = ['127.0.0.1:1978',
|
206
|
+
'127.0.0.1:1979',
|
207
|
+
'127.0.0.1:1980',
|
208
|
+
'127.0.0.1:1981']
|
209
|
+
|
210
|
+
tb = TokyoTyrant::Balancer::Table.new(servers)
|
211
|
+
|
212
|
+
# store server is determined by key which is consistent
|
213
|
+
tb[:foo] = { 'foo' => 'bar' }
|
214
|
+
tb[:bar] = { 'bar' => 'baz' }
|
215
|
+
|
216
|
+
# retrieval server is determined by key which is consistent
|
217
|
+
tb[:foo]
|
218
|
+
# => { 'foo' => 'bar' }
|
219
|
+
|
220
|
+
# aggregate from all nodes
|
221
|
+
tb.size
|
222
|
+
|
223
|
+
# parallel_search based querying across all nodes
|
224
|
+
tb.find{ |q| q.condition(:foo, :streq, 'bar') }
|
225
|
+
|
226
|
+
== Contributors
|
227
|
+
|
228
|
+
* Flinn Mueller (actsasflinn) author/maintainer
|
229
|
+
* Justin Reagor (cheapRoc) specs
|
230
|
+
* Seth Yates (sethyates) run method (lua ext)
|
231
|
+
* John Mettraux (jmettraux) inspiration (rufus-tokyo)
|
data/Rakefile
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
$root = Pathname(__FILE__).dirname
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'rake'
|
8
|
+
require 'rake/clean'
|
9
|
+
require 'rake/packagetask'
|
10
|
+
require 'rake/gempackagetask'
|
11
|
+
require 'rake/testtask'
|
12
|
+
require 'rake/rdoctask'
|
13
|
+
|
14
|
+
task :spec do
|
15
|
+
load $root.join('spec', 'spec_base.rb')
|
16
|
+
end
|
17
|
+
task :default => [ :spec ]
|
18
|
+
|
19
|
+
CLEAN.include('pkg', 'tmp')
|
20
|
+
|
21
|
+
gemspec = Gem::Specification.new do |s|
|
22
|
+
s.name = 'heroku-tokyotyrant'
|
23
|
+
s.version = '0.4'
|
24
|
+
s.authors = [ 'Matt Bauer' ]
|
25
|
+
s.email = 'bauer@pedalbrain.com'
|
26
|
+
s.homepage = 'http://github.com/mattbauer/heroku-tokyotyrant/'
|
27
|
+
s.platform = Gem::Platform::RUBY
|
28
|
+
s.summary = 'A C based TokyoTyrant Ruby binding'
|
29
|
+
s.require_path = 'ext'
|
30
|
+
s.test_file = 'spec/spec.rb'
|
31
|
+
s.has_rdoc = true
|
32
|
+
s.extra_rdoc_files = %w{ README.rdoc }
|
33
|
+
|
34
|
+
s.files = ['COPYING',
|
35
|
+
'Rakefile',
|
36
|
+
'README.rdoc'] +
|
37
|
+
Dir['ext/**/*'] +
|
38
|
+
Dir['lib/**/*.rb'] +
|
39
|
+
Dir['spec/**/*'] +
|
40
|
+
Dir['benchmarks/**/*']
|
41
|
+
s.extensions << "ext/extconf.rb"
|
42
|
+
|
43
|
+
s.add_runtime_dependency('fast_hash_ring', '>= 0.1.1')
|
44
|
+
end
|
45
|
+
|
46
|
+
task :gemspec do
|
47
|
+
File.open('heroku-tokyotyrant.gemspec', 'w') do |f|
|
48
|
+
f.write(gemspec.to_ruby)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
Rake::GemPackageTask.new(gemspec) do |pkg|
|
53
|
+
pkg.need_tar = true
|
54
|
+
end
|
55
|
+
|
56
|
+
Rake::PackageTask.new('heroku-tokyotyrant', '0.4') do |pkg|
|
57
|
+
pkg.need_zip = true
|
58
|
+
pkg.package_files = FileList[
|
59
|
+
'COPYING',
|
60
|
+
'Rakefile',
|
61
|
+
'README.rdoc',
|
62
|
+
'ext/**/*',
|
63
|
+
'lib/**/*.[rb]',
|
64
|
+
'spec/**/*',
|
65
|
+
'benchmarks/**/*'
|
66
|
+
].to_a
|
67
|
+
class << pkg
|
68
|
+
def package_name
|
69
|
+
"#{@name}-#{@version}-src"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'benchmark'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'faker'
|
4
|
+
require 'date'
|
5
|
+
|
6
|
+
#
|
7
|
+
# the data
|
8
|
+
#
|
9
|
+
|
10
|
+
colnames = %w{ name sex birthday divisions }
|
11
|
+
|
12
|
+
$year = (1909 .. 2009).to_a
|
13
|
+
$month = (1..12).to_a
|
14
|
+
$day = (1..28).to_a # not bothering with month diffs
|
15
|
+
|
16
|
+
def rbdate
|
17
|
+
DateTime.new($year[rand($year.size)], $month[rand($month.size)], $day[rand($day.size)])
|
18
|
+
end
|
19
|
+
|
20
|
+
def rdiv
|
21
|
+
case rand(3)
|
22
|
+
when 0
|
23
|
+
'dev'
|
24
|
+
when 1
|
25
|
+
'brd'
|
26
|
+
else
|
27
|
+
'brd,dev'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def rgen
|
32
|
+
(rand(2) == 1 ? 'male' : 'female')
|
33
|
+
end
|
34
|
+
|
35
|
+
data = [
|
36
|
+
[ 'Alphonse Armalite', 'male', DateTime.new(1972, 10, 14), 'brd,dev' ],
|
37
|
+
[ 'Brutus Beromunster', 'male', DateTime.new(1964, 07, 14), 'dev' ],
|
38
|
+
[ 'Crystel Chucknorris', 'female', DateTime.new(1980, 07, 12), 'brd' ],
|
39
|
+
[ 'Desree Dylan', 'female', DateTime.new(1954, 07, 13), 'brd,dev' ]
|
40
|
+
]
|
41
|
+
|
42
|
+
10_000.times do |i|
|
43
|
+
data << [ Faker::Name.name, rgen, rbdate, rdiv]
|
44
|
+
end
|
45
|
+
|
46
|
+
$find_name_list = []
|
47
|
+
100.times { $find_name_list << data[rand(data.size)][0] }
|
48
|
+
|
49
|
+
data.collect! { |e|
|
50
|
+
(0..colnames.length - 1).inject({}) { |h, i| h[colnames[i]] = e[i]; h }
|
51
|
+
}
|
52
|
+
|
53
|
+
data_h = {}
|
54
|
+
i = 0
|
55
|
+
data1 = data.collect { |e|
|
56
|
+
i = i + 1
|
57
|
+
h = e.dup
|
58
|
+
h['birthday'] = h['birthday'].to_s
|
59
|
+
data_h[i.to_s] = h
|
60
|
+
h
|
61
|
+
}
|
62
|
+
|
63
|
+
require 'tokyo_tyrant'
|
64
|
+
|
65
|
+
t = TokyoTyrant::Table.new('127.0.0.1', 45001)
|
66
|
+
t.clear
|
67
|
+
|
68
|
+
2.times { puts }
|
69
|
+
puts 'TokyoTyrant Single'
|
70
|
+
|
71
|
+
Benchmark.benchmark(' ' * 20 + Benchmark::Tms::CAPTION, 20) do |b|
|
72
|
+
b.report('inserting data') do
|
73
|
+
data1.each_with_index { |e, i| t[i.to_s] = e }
|
74
|
+
end
|
75
|
+
|
76
|
+
b.report('reading data') do
|
77
|
+
data1.each_with_index { |e, i| nothing = t[i.to_s] }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
require 'lib/tokyo_tyrant/balancer'
|
82
|
+
|
83
|
+
servers = ['127.0.0.1:45001',
|
84
|
+
'127.0.0.1:45002',
|
85
|
+
'127.0.0.1:45003']
|
86
|
+
|
87
|
+
tb = TokyoTyrant::Balancer::Table.new(servers)
|
88
|
+
tb.clear
|
89
|
+
|
90
|
+
2.times { puts }
|
91
|
+
puts 'TokyoTyrant Balancer'
|
92
|
+
|
93
|
+
Benchmark.benchmark(' ' * 20 + Benchmark::Tms::CAPTION, 20) do |b|
|
94
|
+
b.report('inserting data') do
|
95
|
+
data1.each_with_index { |e, i| tb[i.to_s] = e }
|
96
|
+
end
|
97
|
+
|
98
|
+
b.report('reading data') do
|
99
|
+
data1.each_with_index { |e, i| nothing = tb[i.to_s] }
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'benchmark'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'faker'
|
4
|
+
|
5
|
+
puts "Tokyo Tyrant Bulk Operations Benchmark"
|
6
|
+
|
7
|
+
data = {}
|
8
|
+
data_e = {}
|
9
|
+
data_a = []
|
10
|
+
|
11
|
+
10_000.times do |i|
|
12
|
+
data[i.to_s] = Faker::Name.name
|
13
|
+
data_e[i.to_s] = nil
|
14
|
+
data_a << i.to_s
|
15
|
+
data_a << data[i.to_s]
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'tokyotyrant'
|
19
|
+
|
20
|
+
rdb = TokyoTyrant::RDB::new
|
21
|
+
rdb.open("127.0.0.1", 45000)
|
22
|
+
rdb.clear
|
23
|
+
nothing = nil
|
24
|
+
|
25
|
+
2.times { puts }
|
26
|
+
puts 'TokyoTyrant::RDB (Ruby) mget'
|
27
|
+
|
28
|
+
Benchmark.benchmark(' ' * 20 + Benchmark::Tms::CAPTION, 20) do |b|
|
29
|
+
b.report('inserting data') do
|
30
|
+
rdb.misc('putlist', data_a)
|
31
|
+
end
|
32
|
+
|
33
|
+
b.report('reading data') do
|
34
|
+
rdb.mget(data_e)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
require 'tokyo_tyrant'
|
39
|
+
t = TokyoTyrant::DB.new('127.0.0.1', 45000)
|
40
|
+
t.clear
|
41
|
+
nothing = nil
|
42
|
+
|
43
|
+
2.times { puts }
|
44
|
+
puts 'TokyoTyrant (c) mput/mget'
|
45
|
+
|
46
|
+
Benchmark.benchmark(' ' * 20 + Benchmark::Tms::CAPTION, 20) do |b|
|
47
|
+
b.report('inserting data ') do
|
48
|
+
t.mput(data)
|
49
|
+
end
|
50
|
+
|
51
|
+
b.report('reading data') do
|
52
|
+
nothing = t.mget(0..9999)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
require 'memcached'
|
57
|
+
m = Memcached.new('127.0.0.1:11211')
|
58
|
+
m.flush
|
59
|
+
nothing = nil
|
60
|
+
|
61
|
+
2.times { puts }
|
62
|
+
puts 'Memcached (C) set/get_multi'
|
63
|
+
|
64
|
+
Benchmark.benchmark(' ' * 20 + Benchmark::Tms::CAPTION, 20) do |b|
|
65
|
+
b.report('inserting data*') do
|
66
|
+
data.each_pair { |k, v| m.set(k, v) }
|
67
|
+
end
|
68
|
+
|
69
|
+
b.report('reading data') do
|
70
|
+
nothing = m.get(data.keys)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
puts "* bulk operation not supported"
|