Thursday, November 8, 2018

[google-cloud-sql-discuss] Google Cloud SQL slow outputting query result

I am having a problem querying my database on Google Cloud SQL (mysql second generation): whenever I execute a query, its result is received in a relatively large amount of time, and I've noticed that it's a problem of fetching the data rather than executing the query, because this duration changes every time that I re-run the same query on the same underline data.

My SQL instance is a db-n1-standard-1 and CPU or RAM usage don't get even close to its hardware limitation. I have increased the disk space to 50GB (SSD) to allow higher throughput but nothing changed.

For example, if I query 6MB of data, I get an answer after ~600ms to ~1s when I would expect to receive it in about 300ms given that the lowest throughput on the SSD is 24MB/s and the network throughput is irrelevant at 250MB/s. This happens both when I connect to the SQL instance from my computer or from Google App Engine (I isolated the log for detecting exactly only the query + data transport time), DB is in Belgium, App Engine Server is in London.

If I run the query with the mysql profiling active, I can see that the actual query (the sum of all the durations of the steps) takes about 3ms so my guess is that there is problem transporting the data. I do use some JSON_OBJECT transformation when selecting but I guess that that should be already considered in some of the steps of the profiling result?

Can you please help me to identify and solve the problem?

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/618ff47b-30e3-4719-bf97-914f4bd16669%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment