Skip to content

[Config] Document the Database statistics section #4086

Open
@xuniq

Description

@xuniq

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: #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
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.0admin[area] Related to Admin guideconfig

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions