Question

How to improve NFS Kubernetes Write Performance

Posted June 13, 2020 604 views
Kubernetes

I was following the tutorial found at https://www.digitalocean.com/community/tutorials/how-to-set-up-readwritemany-rwx-persistent-volumes-with-nfs-on-digitalocean-kubernetes and was able to get an NFS share with persistent volume claim across all pods and it is working well with autoscaling.

My challenge is performance. I am having really slow write speeds which is impacting the performance of my PHP application. I’ve modified the mount options during the nfs-server deployment (which I came across in a few other threads) but it doesn’t seem to help.

mountOptions:
    - noatime
    - rsize=8192
    - wsize=8192
    - tcp
    - timeo=14
    - intr 0 0

Does anyone have any ideas as to how to improve the write performance?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

I am also wondering about this question.
Followed the same manual as you, but I get very slow reads, and writes. My usecase is hosting Wordpress sites in Kubernetes.

Sites that use the NFS Server provisioner are to slow to be used in production.

Anyone else having solved this problem?

If you have no control over the choice of NFS or the php application, then I apologise in advance for all this useless advice :-)

I don’t know too much about NFS to be honest, but I wouldn’t be surprised if you’ve simply hit the limit with NFS. If you have the ability to tweak your app’s architecture, you could consider the following:

Are you sure it’s writes that are slow and not reads or both?

Are you storing your PHP code on NFS? If so, it might be better to package the code into a docker container and deploy it that way.

If you do rely on dynamically changing PHP files:

  • Is there a core that’s basically constant?
  • Can you periodically copy the files from NFS and into your app container?

For reading and writing data to storage I would highly recommend considering some sort of blob storage (Digital Ocean spaces, or the Azure/AWS equivalents). It’s easier to use and setup than NFS and will generally give you less headaches.

Maybe your application can be tweaked? Are there settings to cache data or write things out in larger batches? Is there a way asynchronously write while continuing with the rest of the application’s functions?

  • I appreciate you taking the time to respond. Since this is a Kubernetes cluster, I need to have pods autoscale which would require data shared and it would be a challenge to have data synced locally. I’m already using Spaces but need shared storage due to cache and other elements that must be shared between nodes.

    I was hoping to get some direction on the best way to optimize the nfs-server-provider implementation.

Submit an Answer