Why my google cloud sql is so slow? Am I missing something important?

5,077 views
Skip to first unread message

Lawrence Cheuk

unread,
Sep 18, 2016, 2:50:54 PM9/18/16
to Google Cloud SQL discuss
I love google app engine and datastore, have been using them for 3 years. Now I would like to transfer my whole web site to google app engine. Which require use of cloud sql.
I set up every thing import all datatable. Start loading a page. my site is using drupal. the query speed is just very very slow, no matter big or small query. The slow problem show very consistence result. leading a final page render of 6 seconds!!!



I run a simple test. 

load a page containing a some rows, each row contain standard data field like a description, comment field, rating field, title. etc. using google F4 app engine with db-n1-standard-4 ($0.3860/Hr) and AWS Auroa db.r3.large RDS($0.290/Hr) 

I try the first load, google cloud sql is 3000ms slower than aws rds.

and then I refresh a few times until the database ram cached the queries. 

The result are shown on the attached files. 
result is google is 14 times slower than aws rds!!!!!

I love google cloud for its simplicity, beautiful console....now my aws cloud site is ready. Before I leave google cloud sql. I would like to give a last chance here. Ask it to see if I really missed something important or, cloud sql is really slow. I saw some blog post from google saying that it is faster than aws auroa using sysbench with 1 to 500 thread. The benchmark result seems impossible to me, so here is my  guess:

Their test is running from inside the same db instance machine. so it is all about disk i/o speed. But for app engine connect with cloud sql, the bottleneck I guess is the network speed (bandwidth). Although unix socket is used, if the query speed is restricted by a 100Mbps network card, it wont be fast. And it is not about latency mentioned by google. It is not 1ms per query. For query that return larger amount of data, the query is proportionally get much more slower, sometimes it can be 1000ms. And the result is very consistently proportional to the packet size (1s latency per 100kb data not per 1 query) . So I guess it is bandwidth rather than simple latency.

Additonal info that may help find out the problem: ( help PLS!)

my app engine region is us-central1
my cloud sql also in us-central1, sub region I select Any as I don't know my app engine instance is in central1a , 1b or 1c.
my harddisk type I choose is 500GB SSD, which give the highest IOPS.
the way of connection I tried, pdo, mysqli, mysql, all show same behavior slower in a magnitude of 10X than any other modern hardware. (including my 10 years old celeron desktop pc)

I am running php55




FUJIWARA HAO

unread,
May 20, 2018, 12:00:57 PM5/20/18
to Google Cloud SQL discuss
hi there,

I am facing the same issue too. 

azidahaka

unread,
Nov 16, 2018, 11:53:59 AM11/16/18
to Google Cloud SQL discuss
Did you ever figure this out? 

I am almost noticing 1 second+ queries that I would expect to run much faster.

Yasser Karout (Cloud Platform Support)

unread,
Nov 19, 2018, 12:17:41 PM11/19/18
to Google Cloud SQL discuss
Hello,

I suggest to go through this doc on Cloud SQL performance as a check list to eliminate causes of latency.

If you still could not determine the cause, I recommend that you open a new issue on the Issue Tracker website. We might be able to look into your Cloud SQL to see if there is anything that might be causing latency issues.

azidahaka

unread,
Nov 19, 2018, 6:00:56 PM11/19/18
to Google Cloud SQL discuss
Hi Yasser,

I was able to resolve the issue. I was connecting AWS EB (us-west) to GCloud SQL (us-central). When I switched to GKE (us-central) to connect to GCloud SQL (us-central), latency went from 1000ms+ to below 100ms!

I love Google Cloud!!
Reply all
Reply to author
Forward
0 new messages