How to Set the GO Environment Variable GOMEMLIMIT

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 如何设置GO的环境变量 GOMEMLIMIT

| username: 特雷西-迈克-格雷迪

[TiDB Usage Environment] Production Environment
[TiDB Version] 6.1.3
[Reproduction Path] What operations were performed when the issue occurred
[Encountered Issue: Issue Phenomenon and Impact]
How to set the GO environment variable GOMEMLIMIT, and on which components/nodes should it be set?

I want to reduce the frequency of OOM occurrences on the TiDB server.

Set the environment variable GOMEMLIMIT to alleviate OOM issues

[Attachment: Screenshot/Logs/Monitoring]

| username: Kongdom | Original post link

:flushed: Indeed, I couldn’t find it. I suspect it’s prepared for users who are doing secondary development.
This should be an environment variable of the Go language itself.

| username: yiduoyunQ | Original post link

It looks like a system environment variable.

| username: ShawnYan | Original post link

| username: Inkjade | Original post link

This is the environment variable for Go language itself, configured through

vim /etc/profile

For specific memory allocation values, refer to and configure according to your environment:

To apply the configuration:

source /etc/profile
| username: Inkjade | Original post link

If possible, I suggest you upgrade the database to version 6.5.5 or upgrade to version 7.5.

| username: 有猫万事足 | Original post link

The method for setting it has already been described in detail by @Inkjade.

I’ll talk about the issues with setting it in those components/nodes.
Since this environment variable is used by the Go language,
only components written in Go will use this parameter.

Among the main components, the ones that use Go are PD and TiDB.

| username: 特雷西-迈克-格雷迪 | Original post link

Thank you, boss.

| username: 特雷西-迈克-格雷迪 | Original post link

Got it, thanks!

| username: 哈喽沃德 | Original post link


| username: dba远航 | Original post link

There is a system memory limit parameter: mem_lock

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.