High Memory Usage of Drainer Process

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

Original topic: drainer 进程内存使用率很高

| username: Raymond

TiDB cluster version: 4.0.15
After running a large 1G transaction, the memory usage of the drainer process increased, and there was also an alert for binlog_drainer_checkpoint_tso_no_change_for_1m. However, even after the binlog_drainer_checkpoint_tso_no_change_for_1m alert was resolved, the memory usage of the drainer process did not decrease. Has anyone encountered a similar issue?

| username: tidb狂热爱好者 | Original post link

After restarting the drainer, the memory usage should go down.

| username: buddyyuan | Original post link

Try generating a heap profile:

curl http://{drainer_ip}/debug/pprof/heap?seconds=30 > heap.out
| username: Raymond | Original post link

When I executed this at that time, the result showed that the target file had issues. I don’t know why.

| username: buddyyuan | Original post link

Collect again, and then use go tool pprof to view the collected files.
go tool pprof -http={xx.xx.xx.xx}:8080 heap.out