Performance Tuning
Memory Optimization
TDengine provides a memory allocator configuration script, set_taos_malloc.sh
, for optimizing memory allocation strategies. With this script, users can easily switch between different memory allocator modes to improve the performance and stability of TDengine.
TDengine Memory Allocator Configuration Script
set_taos_malloc.sh
is a script provided by TDengine to quickly switch the memory allocation strategy for services such as taosd and taosadapter.
Features
- Supports multiple modes: glibc default allocator, tcmalloc, jemalloc, etc.
- Automatically generates shell environment variable files and systemd environment variable files.
- Supports silent mode (no output messages).
Basic Usage
Parameter Description
-m <mode>
Specify the memory allocator mode.- 0: glibc default allocator
- 1: tcmalloc optimization
- 2: tcmalloc custom check, for memory leak detection
- 3: jemalloc optimization
- 4: jemalloc custom check, for memory leak detection
Result Description
- The script will automatically generate or update the following environment variable files:
- Shell environment variable file:
/usr/local/taos/bin/set_taos_malloc_env.sh
- systemd taosd environment variable file:
/etc/default/taosd
- systemd taosadapter environment variable file:
/etc/default/taosadapter
- Shell environment variable file:
- Log file:
/var/log/taos/set_taos_malloc.log
/usr/local/taos
and /var/log/taos
are the default installation and log paths for TDengine.
Notes
- After modification, it is recommended to restart the taosd/taosadapter service or re-source the environment variable file.
- Only supported when running in the TDengine installation directory.
For more advanced usage, please refer to the script comments or contact operations support.