Tokyo Cabinet and Tokyo Tyrant Introduction
The NoSQL product to be introduced today is the Tokyo cabinet and Tokyo Tyrant,tokyo cabinet is an excellent data storage engine, while Tokyo Tyrant provides a network interface for accessing the Tokyo cabinet data. This is a very mature product, there are many successful cases at home and abroad.
Tokyo Cabinet (TC) and Tokyo Tyrant (TT), as its name implies, are open source projects originating in Japan. Maintained by FAL Labs, the main developer is Mikio Hirabayashi. The earliest application of mixi.jp in Japan's largest SNS website has gained fame after its success.
Tokyo Cabinet Introduction
Tokyo cabinet:super Hyper Ultra Database Manager
http://fallabs.com/tokyocabinet/
Tokyo Cabinet is a DBM database developed by the Japanese flat forest stem male. Tokyo cabinet is a data storage engine written in C, which stores data in a key-value way, supporting a variety of data structures such as hash, B + tree, hash table, and more. It also provides API support for multiple languages such as C, Perl, Ruby, Java, and Lua, but if accessed over a network, TT is required.
Tokyo cabinet is popular for supporting flexible data structures, especially hash table types, much like traditional relational databases, except that each stored record column is freely defined and can be queried by column as a condition. This is a feature that many key-value-structured nosql products do not have. Of course, hash table type and hash, B + tree is less efficient than access, anything has two sides, in a high degree of flexibility at the same time, it is necessary to sacrifice part of the efficiency.
Tokyo Cabinet database Read and write very fast, hash mode write 1 million data only 0.643 seconds, read 1 million data only 0.773 seconds, is Berkeley DB and other DBM several times.
650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "alt=" image "src=" http:// S3.51cto.com/wyfs02/m01/6c/80/wkiol1vk7t-yejvuaajohomttoi836.jpg "border=" 0 "height="/>
Tokyo Tyrant Introduction
Tokyo Tyrant:network interface of Tokyo Cabinet
http://fallabs.com/tokyotyrant/
Tokyo Tyrant: is a network interface written for TC, he supports the Memcache protocol, and can also operate via HTTP, the following is called TT.
Tokyo Tyrant is also written in C, which supports high-concurrency, multi-threaded access TC from the network side. In addition TC/TT supports the Master/slave architecture, which can be configured to achieve high availability, which is also a good feature.
Tokyo Tyrant plus Tokyo Cabinet, a distributed persistent storage system that supports high concurrency, can be viewed as a memcached for any original memcached client, but Its data can be stored durably. This, like Sina's memcachedb nature.
Tokyo Tyrant and Memcachedb Comparison of advantages
Compared to Memcachedb, Tokyo Tyrant has the following advantages:
Fail over
Tokyo Tyrant Support dual-machine mutual primary and secondary mode, the main and auxiliary library can read and write, and memcachedb currently support similar MySQL main and auxiliary library synchronous way to achieve read and write separation, support "master server can read and write, secondary server read-only" mode.
650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "alt=" image "src=" http:// S3.51cto.com/wyfs02/m02/6c/84/wkiom1vk7w2j9nklaad0lgvbrwc991.jpg "border=" 0 "height=" 296 "/>
This uses $memcache->addserver instead of $memcache->connect to connect the Tokyo tyrant server, because when the Memcache client uses the Addserver server pool, it is based on the CRC32 The (key)% current_server_num "hash algorithm hashes the key to different servers, and PHP, C, and Python clients are the same algorithm. The addserver of the Memcache client has a failover mechanism, when 2 Memcached servers are addserver, and 1 of them are down, then Current_server_num will be 1 from the original 2.
Refer to the official website of Memcached and the two paragraphs in the PHP manual:
http://www.danga.com/memcached/
If a host goes down, the API re-maps that dead host's requests onto the servers that is available.
http://cn.php.net/manual/zh/function.Memcache-addServer.php
Failover occur at any stage in any of the methods, as long as other servers is available the request the user won ' t n Otice. Any kind of sockets or Memcached server level errors (except Out-of-memory) may trigger the failover. Normal client errors such as adding an existing key would not trigger a failover.
Small log file size
Tokyo Tyrant The log file used for primary and secondary synchronization is small, about 1.3 times times the database file, and the Memcachedb synchronization log file is very large, if not regularly cleaned, it is easy to write the disk full.
Excellent performance over large volumes of data
However, Tokyo Tyrant also has drawbacks: under 32-bit operating systems, a single file of the Tokyo Cabinet database that is stored as a Tokyo tyrant backend cannot exceed 2G, while 64-bit operating systems are not subject to this limitation. Therefore, if you use the Tokyo tyrant, it is recommended to install on a 64-bit CPU, operating system.
Subsequent
TC/TT is a well-tried and stable product that excels at tens of thousands of data volumes and at the following levels. But developers for a variety of reasons, has been a long time without updating the version, but the introduction of the corresponding upgrade products, called Kyoto Cabinet and Kyoto Tycoon, which also brought uncertainty to the prospects of TC/TT, it is clear that the author is to encourage people to use the upgraded products, But because the new product does not have more success cases, the influence in the industry is not as TC/TT, so at this stage, Tc/tt is still a good nosql choice.
Kyoto cabinet:a straightforward implementation of DBM
http://fallabs.com/kyotocabinet/
Kyoto tycoon:a Handy Cache/storage Server
http://fallabs.com/kyototycoon/
This article is from the SQL Server deep dives blog, so be sure to keep this source http://ultrasql.blog.51cto.com/9591438/1643802
Tokyo Cabinet and Tokyo tyrant Introduction