Mariadb and Disk Speed Problems on Ubuntu 22.04
I recently created a new Linode running Ubuntu 22.04 to replace an older VPS running Ubuntu 18.04. I migrated a few sites to the new server and found that they are considerably slower to load than on the old server. This is especially true for sites with high database usage.
The older server is running Mariadb 10.3, the new one is on Mariabdb 10.6. I created a copy of a database on the new server and when I run the same query on both servers, it is 10 times slower on the new one!
I ran an Explain on the query on both servers and on the new one, it wasn't using indexes in the same way (or at all). I ran
mysqlcheck --optimize on this database and after that, the performance improved, but still 4 times slower than the old server.
I then checked the disk speed on both using the command:
hdparm -Tt /dev/sda. Here are the results:
Old Server (Ubuntu 18.04):
Timing cached reads: 13956 MB in 2.00 seconds = 6984.79 MB/sec
Timing buffered disk reads: 2126 MB in 3.00 seconds = 708.60 MB/sec
New Server (Ubuntu 22.04):
Timing cached reads: 6054 MB in 2.00 seconds = 3028.63 MB/sec
Timing buffered disk reads: 444 MB in 3.00 seconds = 147.98 MB/sec
The new server is more 2 - 4 times slower than the old one!
Could the problem be the physical server that the new Linode is hosted on? Are there problems with Ubuntu 22.04 that haven't been ironed out?
Thanks in advance for any advice.
There are a few factors that can cause degraded performance on your Linode. Hostload, networking issues, internal CPU steal to name a few.
In your case, it's possible that the host could be overloaded and that's what's causing the difference in performance between your two servers. This earlier Community Questions post titled What is CPU steal and how does it affect my Linode? can help you narrow down if CPU steal is occurring on your Linode. If it is, you can open a Support Ticket, share your findings with the Support Team, and request a migration to a new host.
I hope this helps!
[@tlambert] (/community/user/tlambert) - thanks for the suggestions. I opened a ticket and my VPS was migrated to a new server. The sql query speed improved after the move, but still 2-3 times slower than on the old server. I imported a new database, ran a query with joins and on the new server, this was 8 times slower.
I can't understand how a VPS with twice as much RAM and newer software versions can have worse performance. The only other difference is that the old server is in the London data centre and the new server is in Frankfurt. That shouldn't make a difference, right?
Anything other suggestions?