Connecting to a local database on the same EC2 instance has a low latency, but to RDS things get really high. See results below.
time mysql -u root -proot -h localhost -e 'show databases'
+--------------------+
| Database |
+--------------------+
| information_schema |
| biblical |
| mysql |
| performance_schema |
| phpmyadmin |
| shop |
+--------------------+
real 0m0.005s
user 0m0.003s
sys 0m0.000s
but connecting to my amazon RDS instance in the same availability zone give me this
+--------------------+
| Database |
+--------------------+
| information_schema |
| biblical |
| mysql |
| performance_schema |
| phpmyadmin |
| shop |
+--------------------+
real 0m0.090s
user 0m0.000s
sys 0m0.000s
.005 to 0.090 has a large impact on my application's performance (Magento), and this was for a simple query. If performing a more CPU intensive query, this could get way high. Is there anyway to improve this ??