How to get the page cache for a containerized process?
grissomsh opened this issue · 1 comments
If I ran a pod in a Kubernetes environment, I could get the pid by using ps -ef of the process running inside the container.
When I run
./pgcacher -pid=49573
I got a lot of skipping messages
2023/04/26 17:10:08 skipping "/usr/lib/xxx/lib/gson-2.2.4.jar": could not open file for read: open /usr/lib/inceptor/lib/gson-2.2.4.jar: no such file or directory
And the result is quite fewer.
If I copy the pgcacher into the container by using kubectl cp command, I will get the result without any error and with more records.
./pgcacher -pid=1
Is that the right behavior?
结合 nsenter 的解决方法
docker ps | grep # 获取容器 ID
docker inspect -f {{.State.Pid}} # 获取 pid
#进入容器的 process 空间获取进程 id 信息
nsenter --target 3550072 -p -r ps -ef
#进入容器的 process 空间获取 cache 信息
nsenter --target 3550072 -p -r ./pgcacher -pid=119