Hey,
We have attempted to use a Azure VM with Windows 2012 Server R2 Datacenter as a MySQL server for a Azure Website and we noticed that the Azure VM is much slower than our existing VMs (from a local hosting company) at handling MySQL queries.
First we thought that maybe the connection between our VM and website was slow, but after some query profiling using a MySQL client directly we got some rather surprising results: It looks like the Azure VM is almost twice as slow as a VM from the local hosting
company with almost identical specs and software installed.
Azure VM query profile:
Status | Duration |
---|---|
starting | 0,000207 |
checking permissions | 0,000009 |
checking permissions | 0,000010 |
Opening tables | 0,000054 |
System lock | 0,000025 |
init | 0,000101 |
optimizing | 0,000030 |
statistics | 0,000053 |
preparing | 0,000035 |
executing | 0,000289 |
Sorting result | 0,159431 |
Sending data | 0,009420 |
end | 0,000051 |
removing tmp table | 0,000014 |
end | 0,000007 |
query end | 0,000003 |
closing tables | 0,000013 |
freeing items | 0,000054 |
logging slow query | 0,000002 |
cleaning up | 0,000003 |
Local Hosting Company VM query profile:
Status | Duration |
---|---|
starting | 0,000069 |
checking permissions | 0,000002 |
checking permissions | 0,000004 |
Opening tables | 0,000021 |
System lock | 0,000008 |
init | 0,000041 |
optimizing | 0,000012 |
statistics | 0,000025 |
preparing | 0,000014 |
executing | 0,000085 |
Sorting result | 0,079367 |
Sending data | 0,007617 |
end | 0,000033 |
removing tmp table | 0,000008 |
end | 0,000004 |
query end | 0,000002 |
closing tables | 0,000009 |
freeing items | 0,000033 |
logging slow query | 0,000002 |
cleaning up | 0,000002 |
These VMs have almost completely identical hardware specs, the same operating system and only MySQL Server 5.5.40 has been installed by us after the initial setup by Azure or the LHC. MySQL has the exact same config on both machines.
My question is why is the Azure VM so much slower?
100ms extra might not seem like much, but it adds up when we run a lot of similar queries, and the difference is even more noticable when running larger queries.