管理内存
本文介绍如何管理并调优内存资源。
查看内存使用
您可以通过以下方法查看分析 BE 内存使用。
- 通过浏览器或 curl 命令访问 Metrics 接口分析内存使用。
Metrics 统计每 10 秒更新一次。
curl -XGET -s http://be_ip:8040/metrics | grep "^starrocks_be_.*_mem_bytes\|^starrocks_be_tcmalloc_bytes_in_use"
说明:
- 将以上
be_ip改为 BE 节点实际的 IP 地址。- BE
be_http_port默认为8040。
对应指标的含义参考 内存分类。
- 通过浏览器或 curl 命令访问 mem_tracker 接口分析 BE 内存使用。
http://be_ip:8040/mem_tracker
说明:
- 将以上
be_ip改为 BE 节点实际的 IP 地址。- BE
be_http_port默认为8040。

指标说明:
-
level: MemTracker 为树型结构,第一级为 BE 使用总内存,第二级为分类内存使用。 -
Label: 标识内存分类,对应指标的含义参考 内存分类。 -
Parent: 父结点 Label。 -
Limit: 内存使用限制,-1表示没有限制。 -
Current Consumption: 当前内存使用 。 -
Peak Consumption: 峰值内存使用。 -
通过浏览器或 curl 命令访问 TCmalloc 接口分析 BE 内存使用。
http://be_ip:8040/memz
说明:
- 将以上
be_ip改为 BE 节点实际的 IP 地址。- BE
be_http_port默认为8040。
示例:
------------------------------------------------
MALLOC: 777276768 ( 741.3 MiB) Bytes in use by application
MALLOC: + 8851890176 ( 8441.8 MiB) Bytes in page heap freelist
MALLOC: + 143722232 ( 137.1 MiB) Bytes in central cache freelist
MALLOC: + 21869824 ( 20.9 MiB) Bytes in transfer cache freelist
MALLOC: + 832509608 ( 793.9 MiB) Bytes in thread cache freelists
MALLOC: + 58195968 ( 55.5 MiB) Bytes in malloc metadata
MALLOC: ------------
MALLOC: = 10685464576 (10190.5 MiB) Actual memory used (physical + swap)
MALLOC: + 25231564800 (24062.7 MiB) Bytes released to OS (aka unmapped)
MALLOC: ------------
MALLOC: = 35917029376 (34253.1 MiB) Virtual address space used
MALLOC:
MALLOC: 112388 Spans in use
MALLOC: 335 Thread heaps in use
MALLOC: 8192 Tcmalloc page size
------------------------------------------------
Call ReleaseFreeMemory() to release freelist memory to the OS (via madvise()).
Bytes released to the OS take up virtual address space but no physical memory.