How does Kubernetes use the swap space on the host computer?

Hi all! We are now using kubernetes to deploy our ScyllaDB cluster. In this case, can we use the swap space on the host computer?If so, how does Kubernetes use the swap space on the host computer? Thanks!

This is more of a Kubernetes question rather than a ScyllaDB one. In the past, there were no kubelet support for swapping, but this has been changing lately with KEP-2400, which is in Beta in 1.28.

In general, for a ScyllaDB deployment you will want to ensure you use --lock-memory=1 in order to avoid the database process from swapping altogether.

1 Like

Thanks a lot! But I’m still confused that is it recommended to use swap space when we are executing bare metal deployment?

You’re right. In a bare metal / VM deployment the ScyllaDB process typically runs with the --lock-memory option enabled, which causes the process to mlock() the memory area. The swap space, therefore, is left to other processes such as JMX, OS, etc.

On K8s you have the flexibility to set the pod memory in your deployment, as well as limit ScyllaDB’s own memory consumption via the --memory parameter. Ideally, you will also want to --lock-memory, given that it can cause the process to swap once the aforementioned proposal lands in a K8s release.

1 Like

Thanks a lot for your reply. I think I have a clearer understanding of this issue now.