I've switched web hosting recently. The new box is slower than the old one (it's VPS vs. dedicated). However, performance testing reports that a good portion of the slowdown is database-driven.
I have a reference operation. On the old host it runs for 2.2 sec on average, 0.2 sec database access time. On the new one, 18 sec on average, 14 sec database time.
Server is the same - it's local MySQL v. 5.0.91-community in both cases. Connecting over Unix sockets.
What could account for such discrepancy? What server settings should I look at?
-
Too little RAM dedicated to the VPS.
Seva Alekseyev : Unlikely, it reports 800MB free out of 1GB.igelkott : Agreed. How about running "mysqld --verbose --help" on both and checking the diffs?Seva Alekseyev : Done that. The only significant difference is query_cache_size. That could be relevant!From igelkott -
Query caching was disabled on the new box. Brought query_cache_size in line with the old value, and execution time went down to around 3 sec.
From Seva Alekseyev -
Also will want to watch per-CPU utilization - you may only be allocated a hardware thread or a share of a single core, depending on the OS platform and HW architecture of the server your VPS is hosted on. Odds are you're a Solaris Zone (perhaps even a Sparse Zone sharing a common kernel) or a Linux Jail...
I/O data flows are also going to be shared, so if some of your queries require table scans, you'll be butting up against other users and will be waiting for some cycles while their operations complete.
Sounds like a classic virtualization "catch 22" - cheaper service & centralized resource management, but slower performance under peak loads.
From mxmader -
VPS boxes disksystem is usually dependent on other OS's disk usage and therefore sometimes very slow. This can be worsened by small memory amounts of VPS system.
Try tuning down database harddrive access or request independent harddrives.
Using query cache can be a double-edged sword.
Chopper3 : +1 agreed, likely to be oversubscribed storageSeva Alekseyev : What could go wrong with query caching? Overall site performance is not memory-bound, as far as I can tell. It's the CPU mostly.
0 comments:
Post a Comment