Skip to content

Commit bb54244

Browse files
andreyaksenovp7nov
authored andcommitted
document 'memtx_allocator' and 'slab_alloc_granularity' (#3355)
Add reference docs for the `memtx_allocator` and `slab_alloc_granularity` options. Resolves #2291 Resolves #1911
1 parent f916f48 commit bb54244

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

doc/reference/configuration/cfg_storage.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
* :ref:`memtx_memory <cfg_storage-memtx_memory>`
22
* :ref:`memtx_max_tuple_size <cfg_storage-memtx_max_tuple_size>`
33
* :ref:`memtx_min_tuple_size <cfg_storage-memtx_min_tuple_size>`
4+
* :ref:`memtx_allocator <cfg_storage-memtx_allocator>`
45
* :ref:`slab_alloc_factor <cfg_storage-slab_alloc_factor>`
6+
* :ref:`slab_alloc_granularity <cfg_storage-slab_alloc_granularity>`
57
* :ref:`vinyl_bloom_fpr <cfg_storage-vinyl_bloom_fpr>`
68
* :ref:`vinyl_cache <cfg_storage-vinyl_cache>`
79
* :ref:`vinyl_max_tuple_size <cfg_storage-vinyl_max_tuple_size>`
@@ -61,6 +63,26 @@
6163
| Environment variable: TT_MEMTX_MIN_TUPLE_SIZE
6264
| Dynamic: no
6365
66+
.. _cfg_storage-memtx_allocator:
67+
68+
.. confval:: memtx_allocator
69+
70+
Since version :doc:`2.10.0 </release/2.10.0>`.
71+
Specifies the allocator used for memtx tuples.
72+
The possible values are ``system`` and ``small``:
73+
74+
* ``system`` is based on the ``malloc`` function.
75+
This allocator allocates memory as needed, checking that the quota is not exceeded.
76+
77+
* ``small`` is a special `slab allocator <https://github.com/tarantool/small>`_.
78+
Note that this allocator is prone to unresolvable fragmentation on specific workloads,
79+
so you can switch to ``system`` in such cases.
80+
81+
| Type: string
82+
| Default: 'small'
83+
| Environment variable: TT_MEMTX_ALLOCATOR
84+
| Dynamic: No
85+
6486
.. _cfg_storage-slab_alloc_factor:
6587

6688
.. confval:: slab_alloc_factor
@@ -70,11 +92,34 @@
7092
memory depending on the total amount of memory available and the
7193
distribution of item sizes. Allowed values range from 1 to 2.
7294

95+
See also: :ref:`slab_alloc_granularity <cfg_storage-slab_alloc_granularity>`
96+
7397
| Type: float
7498
| Default: 1.1
7599
| Environment variable: TT_SLAB_ALLOC_FACTOR
76100
| Dynamic: no
77101
102+
.. _cfg_storage-slab_alloc_granularity:
103+
104+
.. confval:: slab_alloc_granularity
105+
106+
Since version :doc:`2.8.1 </release/2.8.1>`.
107+
Specifies the granularity (in bytes) of memory allocation in the :ref:`small allocator <cfg_storage-memtx_allocator>`.
108+
The value of ``slab_alloc_granularity`` should be a power of two and should be greater than or equal to 4.
109+
Below are few recommendations on how to adjust the ``slab_alloc_granularity`` value:
110+
111+
* To store small tuples of approximately the same size, set ``slab_alloc_granularity`` to 4 bytes to save memory.
112+
113+
* To store tuples of different sizes, you can increase the ``slab_alloc_granularity`` value.
114+
This results in allocating tuples from the same ``mempool``.
115+
116+
See also: :ref:`slab_alloc_factor <cfg_storage-slab_alloc_factor>`
117+
118+
| Type: number
119+
| Default: 8 bytes
120+
| Environment variable: TT_SLAB_ALLOC_GRANULARITY
121+
| Dynamic: no
122+
78123
.. _cfg_storage-vinyl_bloom_fpr:
79124

80125
.. confval:: vinyl_bloom_fpr

0 commit comments

Comments
 (0)