Question

How to improve NFS Kubernetes Write Performance

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?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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?