Version/Environment (if relevant):
This applies to any version of Domino Data Lab and any compute environment.
When you run system commands in a workspace terminal, like top, free, or others, the values returned will likely appear larger or incorrect for what you expect of the container running that workspace.
This is expected because of the way containers currently work on Linux. Container processes make use of the cgroup file system but most Linux commands which provide system resource metrics were created before cgroups even existed. Instead of something like cgroups, commands like free and top rely on the
proc virtual filesystem.
/proc/PID/smaps and others are not aware of the cgroup file system, thus not aware of containers. They will always report numbers from the host/node system.
Print the current memory usage with the command:
Print the current cpu usage with the command:
In Kubernetes tools:
If you have access to your kubernetes cluster and it is running metrics-server, then try
kubectl top pod then look for your pod-name (via RUN ID of your workspace). If you don't have metrics-server installed, then the above command will result in an error: error: Metrics API not available.
If you don't have metrics-server installed you can exec into your pod, then run the above cat cmds.
Theoretically if you have ssh access to the node, you could also run
docker stats, see https://www.docker.com/blog/how-to-monitor-container-memory-and-cpu-usage-in-docker-desktop/