In-memory storage
Example on GitHub: memtx
In Tarantool, all data is stored in random-access memory (RAM) by default. For this purpose, the memtx storage engine is used.
This topic describes how to define basic settings related to in-memory storage in the
memtx section of a YAML configuration
– for example, memory size and maximum tuple size.
For the specific settings related to allocator or sorting threads,
check the corresponding memtx
options in the Configuration reference.
Note
To estimate the required amount of memory, you can use the sizing calculator.
In Tarantool, data is stored in spaces. Each space consists of tuples – the database records. To specify the amount of memory that Tarantool allocates to store tuples, use the memtx.memory configuration option.
In the example below, the memory size is set to 1 GB (1073741824 bytes):
memtx:
memory: 1073741824
The server does not exceed this limit to allocate tuples. For indexes and connection information, additional memory is used.
When the memtx.memory
limit is reached, INSERT
or UPDATE
requests fail with
ER_MEMORY_ISSUE.
You can configure the minimum and the maximum tuple sizes in bytes.
- If the tuples are small, you can decrease the minimum size.
- If the tuples are large, you can increase the maximum size.
To define the tuple size, use the memtx.min_tuple_size and memtx.max_tuple_size configuration options.
In the example, the minimum size is set to 8 bytes and the maximum size is set to 5 MB:
memtx:
memory: 1073741824
min_tuple_size: 8
max_tuple_size: 5242880