Entries tagged with tokyotyrant

Kyoto Tycoon in 2019

photos/kyoto-tycoon-logo.png

I've been interested in using Kyoto Tycoon for some time. Kyoto Tycoon, successor to Tokyo Tyrant, is a key/value database with a number of desirable features:

  • On-disk hash table for fast random access
  • On-disk b-tree for ordered collections
  • Server supports thousands of concurrent connections
  • Embedded lua scripting
  • Asynchronous replication, hot backups, update logging
  • Exceptional performance

Read more...

Kyoto Tycoon and Tokyo Tyrant with Python

kt-logo

I recently open-sourced a Python library for working with the networked key/value databases Kyoto Tycoon and Tokyo Tyrant. These databases sit atop Kyoto Cabinet and Tokyo Cabinet, respectively, and provide fast DBM implementations.

The Cabinet libraries expose a familiar key/value API backed by a number of different storage options, including persistent hash-tables and b-trees, as well as in-memory variants. A cabinet database can only be accessed by a single process at any given time, though they can be used safely in multi-threaded environments. For this reason, the author created an evented network layer that can expose these storage interfaces to multiple processes. These database servers are Kyoto Tycoon and Tokyo Tyrant, and in addition to providing a fast front-end to the underlying storage engines, they can add features like lua scripting, multi-master replication and LRU cache eviction.

Some scenarios in which you might find these databases useful:

  • Memcached or Redis replacement. The LRU eviction provided by Kyoto Tycoon, combined with being scriptable with Lua, and backed with persistent storage, allows these databases to go beyond traditional key/value database roles.
  • Time-series and event-logging. The B-Tree storage engine supports fast range scans and ordered key traversal, for rolling-up events, map/reduce workflows, and reporting.
  • Full-text search, using the hash storage engine.
  • Secondary indexes for external data-stores.
  • Document database using lua tables in place of JSON objects.

Features of the kt library:

  • Binary protocol support implemented as a C extension.
  • Thread-safe and greenlet-safe.
  • Simple and memorable APIs.
  • Full-featured implementation of the protocols.
  • Multiple serialization schemes, including JSON, msgpack and pickle.

If you're interested in trying out these fantastic databases with Python, the documentation for kt can be found here: http://kt-lib.readthedocs.io/en/latest/

Read more...