I would love to know if anybody knows why this is happening. i've just migrated over to Amazon RDS for our website and our biggest query which takes .2 seconds to execute on my macbook takes 1.3 seconds to execute on the most expensive RDS instance.
Obviously i've disabled query cache (and tested this) on my local computer and both databases are exactly the same. InnoDB, both have the same indexes etc. It's costing us a fortune ($2000 per month) for the fastest RDS instance and i'm losing faith quickly. any ideas?
Try experimenting with the Provision IOPS that RDS offers. Regardless of instance size, the IO is limited, and you can use the Provision IOPS settings, at an additional cost, to improve IO performance.
AWS RDS Provision IOPS
The main reason should be latency between your computer and the Amazon RDS instance. Where are you based? If you're in the US, make sure you use RDS in either US-East or US-West. If you're in Europe or Japan or Asia, there are regions there as well.
I had a similar issue on a Rackspace server instance. Queries took ages to execute, even with Innodb configured to the best of my efforts. I ended up moving to the dedicated database product offered by Rackspace. My guess is that disk intensive services such as databases does not thrive that well on virtualised servers where disks are shared between multiple instances. In general, it appears to be agreed upon on that mysql works best on bare metal or other infrastructure optimised for databases. I might be wrong, but this is the conclusion i came to.
MySQL query cache is OFF by default in RDS. This won't help the performance of your initial query, but it may speed things up in general.
You can set
query_cache_type
to1
and define a value forquery_cache_size
. I also changed thethread_cache_size
from 8 to 24 andinnodb_io_capacity
from 200 to 1900, but I don't know if it helps you.Also creating AWS DB Parameter Groups helped me a lot with configuring and tuning DB variables.