Tarantool is a very interesting database.
An idea about it can be obtained from the report of Konstantin Osipov
Tarantool: how to handle 1.5 billion requests per day?With this note I want to draw attention to the unique features that distinguish Tarantool from other similar solutions and make it a useful tool.
In addition, I will tell you how you can help this open source project and why it's cool :)
What is Tarantool
Keywords for direct loading into the brain
nosql, key-value, in-memory, durable, write-ahead log, snapshot, master-slave replication- This is a very fast in-memory database.
- Key-to-Structured Value Data Model
Each value is a tuple of an arbitrary number of fields.
For example:
(101, "johnsmith", "25Ezk62$i2Z12QYY", "USA")
(102, "ivankuznetsov", "35Fal73$y3x23KZZ", "RUS")
- The first element of a tuple is the primary key that is used to access the entire tuple.
- Reading is always from memory
- Data in memory is protected by transaction log and snapshots on disk
Tarantool is a mature project.
Tarantool is developed in Mail.ru and is actively used there.
In a sense, Tarantool can be compared with Nginx, which was developed in Rambler, and only after some time gained its well-deserved fame and recognition of the community, being an open project.
')
Key Tarantool features
First of all, I want to emphasize that Tarantool is not a clone of Redis or, even more so, Memcached.
With Redis, it is congenial, but not very similar in features. For some tasks, Redis is better suited, for others, Tarantool is better.
- Key spaces
Spaces are collections of objects. You can think of spaces as separate tables. This is convenient, because in one collection, as a rule, there are entities of the same type. In the same Redis, for the separation of entities, it is proposed to simply add a prefix to the keys ( "user: 1001", "session: 9994513" ). Each space in Tarantool can have its own set of indexes.
- Integer keys
Along with string keys in Tarantool there is support for integer keys (32 and 64 bits)
Firstly, it is obvious that access by 32 or 64-bit keys is faster than by keys of arbitrary length. Secondly, it may just be more convenient, for example, when using numeric IDs in a traditional (SQL) database.
- Secondary indexes
Most key-value stores are limited to access by primary key. In Tarantool, you can make selections for individual attributes of the tuple (for this field must be indexed).
- Secondary indexes may not be unique.
This means that a query on a non-unique field can return a set of values. For example: “return all users with country code RUS”
- Composite Indexes
You can include multiple tuple fields in one secondary index. This is a complete analogue of composite indexes in "traditional" (SQL) databases. Composite indexes allow you to make queries on incomplete coincidence (wildcard). When only the first part of the index is known, Tarantool will return all relevant values.
- Samples by value range
Unlike most key-value stores, Tarantool has the ability to extract ranges of values (only for integer keys and only when using an index of type TREE)
By the way, this is done by a stored function (see below).
- Stored Functions on Lua
In Tarantool, you can write stored functions on Lua. Lua is a very simple language that supports JIT compilation. In short, they are very fast. Stored functions allow you to implement data schemes with a rather complex structure. For example, fifo or some ring buffers.
- Background processes within the database
On Lua, you can do not only the processing of individual requests, but also implement background processors (in the cooperative multitasking mode).
- Simple SQL Client
It should be used primarily for experimentation and introspection during development. Simple SQL queries are supported, such as SELECT * FROM t0 WHERE k0 = 42
.
How to start using Tarantool right now
- Tarantool has a simple SQL client.
With it, you can make any requests and experiment, without writing a single line of code - Tarantool supports Memcached protocol
Use Tarantool as the best Memcached (with snapshots and transaction logs on disk). - For Tarantool, there are client libraries in python, ruby, perl, php, java and C
Think about how to use the Tarantool features in your project.
How can I help?
Tarantool is a mature system that has long been in real use.
But as an open project, it exists relatively recently. Therefore, there is little information on the Internet, the community is small, the documentation is not perfect, O'Relly does not publish books ...
And this is good! Indeed, in a project that is already widely known, it is difficult to do something significant - everything is done before us. And here - no!
Therefore, you have a real chance to make a significant contribution to the development of this promising project.
Early followers always win. This project may well become noticeable, for example, as Nginx.
Join now and the glories of glory will touch you :)
- Try it! Ask questions in the mailing list. Write blog posts and
- Use in your projects (you can just start by replacing memcached)
- Make packages for your distribution
- Create and refine client libraries.
- Send patches to the server. Or even fork and do something of your own!
Links