nacos-group / nacos-k8s

This project contains a Nacos Docker image meant to facilitate the deployment of Nacos on Kubernetes using StatefulSets.
578 stars 468 forks source link

Nacos Pod takes up a lot of memory cache #435

Open shaxiaozz opened 9 months ago

shaxiaozz commented 9 months ago

I deployed the Naocs cluster in K8s according to the official website installation documentation: https://nacos.io/zh-cn/docs/use-nacos-with-kubernetes.html.

Issue Description

I found a problem. As the service life of nacos pod continues to increase, the memory cache is also gradually increasing, and the memory cache usage is consistent with the RSS memory. I want to know whether nacos is constantly performing file IO operations? Why is the file handle not disconnected until the operation is completed, causing the memory cache to continue to increase?

The following is my Prometheus monitoring data on nacos pod (data for the last 30 days): It can be seen that the memory cache continues to increase until the memory cache uses nearly 1GB of memory space. During this period, observation and monitoring did not find that the memory cache was recycled. image

At the same time, we entered the container and followed the lsof command, and checked the file handles opened by the current process. We found that the file handles of the following two directories were always open: /home/nacos/logs/ /home/nacos/data/protocol/raft/

Therefore, I am very curious about why nacos needs a large amount of memory cache.

My Environment

Host OS:CentOS Linux release 7.9.2009 (Core) 3.10.0-1160.el7.x86_64 Kubernetes Version:v1.18.20 Docker Version:docker://20.10.7 Nacos Server Version:nacos-server/nacos-server:v2.2.1