I’ll bet that you run applications that are constantly hitting the database. Now you want to increase the speed of your VPS because the storage space feels there’s too much latency. I’ve been there before, and one of the worse feelings is dealing with slowness in your database. So let’s talk about how to get your VPS up to high IOPS (i.e., real fast read/write) without making it too difficult. Sound fair?
High IOPS will help when you:
• Are running MySQL, PostgreSQL, MongoDB, etc.
• Are processing many read/write requests
• Have applications that write log file constantly
• Are doing a lot of heavy analytics
When the disk performs faster, the database performs faster - It's that simple.
NVMe SSD
SATA SSD
ext4
For MySQL or MariaDB:
Use:
Use:
The Importance of High IOPS
Ever opened your app and seen it freeze for a second and wondered why? Many times it's the storage that’s creating the issue. All this means is that the disk has to work too hard to process the read/write.High IOPS will help when you:
• Are running MySQL, PostgreSQL, MongoDB, etc.
• Are processing many read/write requests
• Have applications that write log file constantly
• Are doing a lot of heavy analytics
When the disk performs faster, the database performs faster - It's that simple.
Select the Correct VPS Storage
VPS storage types differ among the service providers. Do you want lots of IOPS (Input/Output Operations per Seconds)? Choose the right storage.NVMe SSD
- Extremely fast
- Best for databases
- Provides the highest IOPS
SATA SSD
- Good, but slower than NVMe
- Okay for smaller applications
- Very slow
- Avoid for heavy database applications
Choosing a Good Filesystem
Your choice of system file system is very important, too.ext4
- Very reliable
- Good performance
- Good for workloads that write a lot of data
- Well suited for large database
Tune Your Database Settings
Even if you have fast storage, it won't matter if your database is not tuned. You might want to try some of the following settings:For MySQL or MariaDB:
- Increase innodb_buffer_pool_size
- Use row format = dynamic
- Enable innodb_flush_log_at_trx_commit = 2
- Increase shared_buffers
- Increase effective_cache_size
- Tune your checkpoint_timeout
Use Caching to Reduce Disk Stress
Why go to the disk over and over when you can use RAM instead?Use:
- Redis
- Memcached
Check IOPS Regularly
How do you know your server is fast? You check it.Use:
- iostat
- iotop
- Grafana dashboards
Conclusion
Setting up your VPS for IOPS is not that hard and you will need:- Fast NVMe storage
- A good filesystem
- Basic database tuning
- Caching
- Regular monitoring