Have you ever witnessed your VPS lagging even if CPU/RAM was barely being used? I have, and CPU wasn’t the issue, I/O performance was. I/O performance refers to the reading and writing speed of your VPS. Let’s keep it bare bones and fix it.
What does I/O Performance mean?
I/O is like a delivery road between your CPU and storage. If there's traffic (slow disk), your VPS will slow down. If it takes forever to open a file or your site is slow to load usually comes down to I/O speed. I once had an issue that took hours because my website backups were being written on an HDD that was shockingly slow, I learned a few ways to make everything much better.
1. Choose The Right Storage
If your VPS is still using an HDD, it’s time for a change. SSD VPS hosting is significantly quicker better, or if you prefer, you upgrade to an NVMe SSD.
Here’s the simple difference:
• HDD: An older and slower option.
• SSD: A faster and more reliable option.
• NVMe SSDs: Lightning fast – great for heavy traffic or databases.
Tip: Always check what type of storage your VPS provider offers before purchasing.
2. Check Disk Usage
Sometimes your VPS may be slow because something is consuming too much of the disk speed. You can use iostat, iotop, or dstat to identify what is happening.
When I checked it, my backup job was causing all of the slowness. After moving it to run during the night, my VPS was able to run a lot faster.
3. Caching
Caching is storing data in memory instead of on disk, so your VPS does not have to read them from the disk over and over again. There are many caching solutions, including Redis, Varnish or Memcached. Caching can be compared to leaving your favorite apps open vs. completely closing them out and opening them back up; it is much faster!
4. Choose a Good File System
If your VPS will allow it, choose an Ext4 or XFS file system. Ext4 works great in the general use case and XFS works better for larger files. Another thing is to change the I/O scheduler type to a faster one such as noop or deadline for speed with a virtual server.
5. Clean and Update
Get rid of old files and logs and applications you don't use anymore; although they may be small, you are taking up space and slowing your VPS down by clutter. And always do your updates regularly because they normally have performance and speed updates.
Final Thoughts
It is pretty easy to optimize I/O performance on your VPS. Fast storage, good caching, and frequent cleaning make the VPS usable and speedy.
So the next time your VPS feels slowed down, don’t panic. Just check your disk setup, it may even be something simple!