appengine cloud sql performance issue ,taking too much time to process the request

296 views
Skip to first unread message

Anoop

unread,
Jul 27, 2016, 4:39:29 AM7/27/16
to Google App Engine

on my django project i am using app-engine with cloud sql, the problem i am facing a significant performance issue , app-engine is taking too much time to process the request like 3,4 minutes, when i looked at the trace its showing a latency below 1.5 seconds which was expected. my app-engine is of F1 instance class Min Idle Instances, Max Idle Instances and Max Concurrent Requests as auto, and cloud sql is a High memory machines with 2CPU 13GB memory.

and its happening even if i am the only user in the project, i don't know where i am going wrong, how can i improve the perfomance?

Nicholas (Google Cloud Support)

unread,
Jul 27, 2016, 4:53:50 PM7/27/16
to Google App Engine
It's somewhat difficult to tell from your description what the cause of the slowness might be.  Just to clarify, in Stackdriver Traces, the latency for a given request appears to be the time taken from when the client request is received and when the server response is sent.  Is this in fact the latency you are seeing below 1.5 seconds?  Are these the same requests that take longer than 3 or 4 minutes?  Is this slowness specific to a given URL handler or are all handlers slow?  Could you elaborate on what this slow handler is doing in a linear way like so?
  • Receive request
  • Authenticate user
  • Parse user input
  • Connect to Cloud SQL instance
  • Insert new row
  • Disconnect from Cloud SQL instance
  • Send response to user
A description of tasks performed by a given handler can be very helpful in identifying bottlenecks.

Anoop

unread,
Jul 29, 2016, 1:47:29 AM7/29/16
to Google App Engine
hi NIcholas,
its the same request that is taking different time to complete the task, in my case two users are accessing same row at the same time and the row it self has a size of 100KB ,its a turn based game, so first turn it works perfectly , second turn you will get this delay of at least 3 to 4 minutes,every turn is an updation to the same row, is it because of the size of the row, i run the same application on compute engine keeping my db within compute engine everything works as expected.

Nicholas (Google Cloud Support)

unread,
Aug 3, 2016, 4:41:03 PM8/3/16
to Google App Engine
Thanks for providing a little more information.  3 to 4 minutes is indeed strange but I cannot reproduce this latency.  For testing, I created 100,000 rows of text columns. Then sent over 100 requests to an App Engine instance that retrieves a single row (always the same one) and updates it.  I've had no issues getting these rows updated in under 1 or 2 seconds per request albeit with some contention issues since always reading/writing to the same row.

To reiterate, I would need a lot more context to help your identify the source of the bottleneck.  Have you tried using Stackdriver Trace to identify what is taking the bulk of time to respond to a request?  Is it when processing the request, connecting to the DB, reading the row, writing to the row, closing the connection, compiling the response, any of the above?


On Wednesday, July 27, 2016 at 4:39:29 AM UTC-4, ANOOP M.S wrote:

Anoop

unread,
Aug 4, 2016, 12:23:52 AM8/4/16
to Google App Engine
No I haven't used Stackdriver , i will use now and update you. In my case request processing works perfectly with small data, it has a problem when its working with large data and manipulating it. any limitation for app engine in handling large amount of data?

Christian F. Howes

unread,
Aug 4, 2016, 3:01:41 PM8/4/16
to Google App Engine
What are you doing with "large data"?  if you are loading large amounts of data into ram, processing it and then writing it back to the database it will be slower then smaller transactions.  There is a maximum read/write throughput and a max CPU speed on your DB and instances.

Nicholas (Google Cloud Support)

unread,
Aug 8, 2016, 11:10:14 AM8/8/16
to Google App Engine
Good day Anoop,

I hope your testing is going well.  To help test latency, I would strongly suggest you consider the following:
  • What the average size of a client request payload sent to your App Engine instances?
  • How many of these requests are you seeing per second or minute during high latency periods?
  • What is the size of the payload sent to your Cloud SQL instance?
  • How long does it take to insert that new data into a given SQL table(s)?
  • How long does it take to connect to and disconnect from the SQL instance?
Answers to the above questions may shed some light on various possible bottlenecks.  As previously suggested, handling large amounts of data at once may hinder performance as a large single insert requires linear execution.  Whereas inserting multiple smaller units of data lends itself quite well to concurrent execution allowing each request handler to complete sooner to handle new incoming requests.

I hope the questions above are helpful and look forward to your findings.


On Wednesday, July 27, 2016 at 4:39:29 AM UTC-4, ANOOP M.S wrote:
Reply all
Reply to author
Forward
0 new messages