I have always set up machines to have a typical LAMP set up and recently I've been testing an external database set up with Google Cloud SQL. The performance hits I'm taking from it seem a bit unreasonable though.
The average load speed of my website with a local database is 0.04s. With a connection to Cloud SQL over SSL the load speed is 0.4s. ~10x slower, so I investigated this and learned about connection pooling and how PHP doesn't support it, but ODBC does and that's what my server seems to be using, so that's good but ~10x slower is still bad.
I tried setting up a Cloud SQL Proxy with the hope of that being a solution, but after setting it up earlier today it gave me a load speed of 5s. ~100x slower, so definitely not a solution.
Is there something that I can do to get a near local database speed using the Google Cloud Platform, should I use some other service for better performance, or do I just have to take this performance hit and live with it?
EDIT:
More information about the system.
The web server is a compute instance on Google Cloud Compute.
Both the Compute instance and the SQL instance are in the same zone using g1-small (1 vCPU, 1.7 GB memory).
It seems like the latency is about 1 millisecond.
Comparison of query runtimes: Local db on the left, Remote db on the right
Right now each of these queries is individually sent across the network, so using a multi query could save me a lot of time, assuming PHP actually sends all the query in a single network request.