[Config] Document the `Database statistics` section
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 15
- Forks
- 49
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 3
Description
Product: Tarantool
Audience/target: administrators
Root document: https://docs.d.tarantool.io/en/doc/gh-4012-memtx-config/book/admin/
SME: @ Gumix
Details
https://www.tarantool.io/en/doc/latest/release/3.0.0/#database-statistics
Related issue: https://github.com/tarantool/doc/issues/3841
Draft
Check the database statistics
-----------------------------
Tarantool provides the statistics about memory consumption for the given space or specific tuples.
Available statistics:
* The amount of memory used for the :ref:`data of the specified space <configuration_memtx-statistics-space>`.
* The amount of :ref:`additional memory <configuration_memtx-statistics-additional>` used for the supplementary information.
* The :ref:`total memory usage <configuration_memtx-statistics-total>`.
Space
~~~~~
To get the amount of memory in bytes occupied by the specified space, use the :ref:`space_object:bsize() <box_space-bsize>` method.
The function returns the total number of bytes in all tuples.
.. code-block:: console
memtx:instance001> box.space.books:bsize()
---
- 70348673
...
Additional memory
~~~~~~~~~~~~~~~~~
To check the usage of the additional memory, use the ``space_object:stat()`` method.
The following information is provided:
- ``header_size`` and ``field_map_size``: the size of service information.
- ``data_size``: the actual size of data, which equals to ``space_object:bsize()``.
- ``waste_size``: the size of memory wasted due to internal fragmentation in the `slab allocator <https://github.com/tarantool/small>`_.
.. code-block:: console
memtx:instance001> box.space.books:stat()
---
- tuple:
memtx:
waste_size: 1744011
data_size: 70348673
header_size: 2154132
field_map_size: 0
malloc:
waste_size: 0
data_size: 0
header_size: 0
field_map_size: 0
...
To get the usage of the additional memory (5 Mb) for the specified tuple, use ``tuple_object:info()``:
.. code-block:: console
memtx:instance001> box.space.books:get('1853260622'):info()
---
- data_size: 277
waste_size: 9
arena: memtx
field_map_size: 0
header_size: 10
...
Total memory usage
~~~~~~~~~~~~~~~~~~
To get the total memory usage in bytes for the slab allocator, use the :ref:`box.slab.info() <box_slab_info>` function:
.. code-block:: console
memtx:instance001> box.slab.info().items_used
---
- 75302024
...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the linked root document for the administrator guide and compare its existing configuration coverage with the Database statistics release note. Incorporate the supplied draft and examples so the section explains space, additional, tuple, and total memory statistics; done when administrators can follow the documented commands.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100