charles leifer | Kyoto Tycoon in 2019

charles leifer | Kyoto Tycoon in 2019

January 07, 2019 20:24




zero feedback


I have been in the usage of Kyoto Tycoon
for a while. Kyoto Tycoon, successor to Tokyo Tyrant, is a key/worth database with a variety of fascinating options:

  • On-disk hash desk for quick random get entry to
  • On-disk b-tree for ordered collections
  • Server helps 1000’s of concurrent connections
  • Embedded lua scripting
  • Asynchronous replication, scorching backups, replace logging
  • Exceptional efficiency

This PDF supplies a perfect
description of the database, its efficiency and implementation. Unfortunately,
it is vitally tough to search out anecdotal details about Kyoto Tycoon (KT) or
its significant other garage engine Kyoto Cabinet.
Debian supplies applications for KT, and there are a couple of questions and solutions on
however the absence of a visual consumer group, and the detritus we usually
go along with one, is regarding.

KT turns out to crop up in fascinating puts, then again. CloudFlare, the internet
efficiency wizards, have a fork
in which they have added give a boost to for inter-node communique the usage of SSL. It
turns out like (at one time?) they had been the usage of it to globally mirror records from a
Postgres DB
. Altice
Labs, a telecommunications consulting company, is actively keeping up a separate
fork in which they have made a variety of
small adjustments (they actually have a great quick-start kind information on configuring

It is just a little more straightforward to search out details about Tokyo Tyrant (TT),
which used to be followed via the Ruby group early in the NoSQL hype cycle. It turns out
to have in large part light from the image as of 2010, then again, and many of the
to be had data is composed of the most straightforward varieties of tutorials. From the
dates of the articles, Jstomer repos, and shows I have been ready discover,
it kind of feels like TT loved a short lived surge of developer passion, and everybody had
moved on by the point KT used to be launched.

According to db-engines, a
web site which supplies scores of database recognition, KT is against the ground
of the heap of the ranked databases. Tokyo Tyrant, its predecessor, fares a bit higher but it surely nonetheless falls under databases
like WiredTiger, Tarantool, FoundationDB and ZODB.

The authors of KT and TT appear to have left the web in the back of in the early
2010’s, and sooner or later they changed their website online
with an image of 2 lovely kids and the phrases:
We are rearing kids.

Why KT?

At this level I might like to try to respond to the query why – why would
someone use this database, deserted via its authors and, missing a group of
or invested customers, to all intents and functions lifeless?

I see a few causes. KT has a great deal of overlap with the vastly
fashionable database Redis. Some similarities:

  • Evented server task in a position to dealing with loads of concurrent connections
  • Scriptable by means of Lua
  • Emphasis on pace of database operations (get, set, delete, and many others)

Redis has a variety of distinctive options:

  • Efficient implementations of quite a lot of data-structures, akin to lists, hashes,
    units, looked after units, and many others.
  • Massive consumer group. If there is a computer virus, any individual will in finding it. Just about everybody has a Redis server someplace
    in their stack.
  • Responsive writer and maintainer, who’s in my opinion invested in proceeding to
    support the challenge.
  • Constantly below power to innovate and support.

KT has some benefits as smartly:

  • Persistence. This is the massive one. KT helps larger-than-RAM data-sets.
    Yes, Redis can periodically sell off to disk (RDB), or you’ll take a efficiency
    hit and permit AOF, however patience is an after-thought and the whole thing wishes
    to be loaded into reminiscence when the usage of Redis.
  • Multi-threaded server task. This is the opposite large one. Redis is
    single-threaded and, thus, can best occupy a unmarried CPU core. Thanks to its
    utilization of an event-loop, we hardly ever understand this as the majority of time is spent in
    socket i/o, however check out operating a gradual command or Lua script and all the
    server will block till it finishes. Besides operating on a couple of cores, KT
    must be a lot more resilient and predictable in the face of occasional gradual
  • Multiple databases the usage of other storages may also be uncovered via a unmarried
    server, as an example, I will have an on-disk hash desk, an on-disk b-tree, and
    an in-memory hash desk all uncovered via the similar server task.
  • Multi-master replication.
  • Compact binary protocol for sure operations.
  • Compression (lzo for pace, zlib, or lzma for compactness).

Neither of those lists are exhaustive, however expectantly they supply some perception
into the factors I used to be in when comparing KT. Furthermore, KT is
the fruits of the authors’ revel in with two different an identical databases,
QDBM and the Tokyo- database/server. TT and KT had been deployed on a high traffic
Japanese social-network and, thru trial via hearth, could also be “finished” in the
eyes of the authors.

How speedy is it?

I put in combination a easy benchmarking script that when compared the efficiency of
the core key/worth operations. For the exams I used the kt python Jstomer
I wrote, and the redis-py Jstomer
(examined with and with out hiredis). The effects point out that, even if studying
from and writing to disk, KT has a measurable efficiency merit.

The benchmark used a unmarried task and a unmarried connection (established forward
of time to steer clear of the latency of connecting). In a multi-process benchmark (no longer
proven), KT’s merit turns into extra pronounced.

KT and Redis performance

The size is operations-per-second, and bigger is

The supply code
for the benchmark is to be had so that you can criticize, at the side of the uncooked effects,
which come with a handful of extra measurements at the side of a couple of
further databases (Tokyo Tyrant, Memcached, e.g.).

As an extra notice, KT is a server front-end for Kyoto Cabinet, a
lower-level embedded garage engine. For this reason why, KT isn’t truly
similar to “pure” garage engines like LevelDB or what-have-you.

Trying it out

I determined to offer it a attempt to had been the usage of it as a cache for a handful of
websites I deal with, together with this one. Anecdotally, the consequences have truly
inspired me, and I plan on proceeding to research the right way to higher make the most of
this new piece of era in my atmosphere. For caching huge HTML chunks,
I discovered that gzipping them at the client-side (in a bit cache software
module) stepped forward efficiency round 2x. I additionally am applying the fast bulk
get API to successfully fetch a couple of pieces from the cache, thereby heading off
roundtrip prices. All-in-all it’s amazingly speedy, easy to control, and due to
being power, there are not any warm-up consequences.

More experimenting

I can unquestionably be doing a little extra experimenting with KT. The Lua scripting
exposes a ton of capability.
The b-tree implementation helps speedy prefix matching and vary scanning, and
could be appropriate for secondary indexes, time-series records, and many others. I lately
watched Rick Houlihan’s communicate from AWS re:invent,
in which he describes refined (totally hacky) key building schemes
to give a boost to advanced relational records in DynamoDB. Many of those ways may
be carried out to KT’s B-Tree, which might function a quick secondary index.

I’m hoping you discovered this publish fascinating. If you would like to be informed extra in regards to the
Kyoto Cabinet/Tycoon database, listed here are some helpful hyperlinks:

If you could have revel in with any of those equipment I might love to listen to your battle
tales…expectantly they are no longer battle tales, regardless that. Success tales, perhaps.


Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker