Thursday, October 29, 2020

[google-cloud-sql-discuss] Slow Cloud SQL performance from AppEngine

Hi All - I've posted this in the GAE group but thought there may be benefit of posting here as I'm not sure where the problem lies and don't want to eliminate Cloud SQL or it's config being the issue, and there's similar threads in the past.

At the moment I'm experiencing significantly slower Cloud SQL performance from AppEngine than I am from Cloud Run

I'm Testing whether to move away from AWS and which GCP solution to move to and have fired up instances of Cloud Run and AppEngine to test a NestJS API.
Having added logging to isolate just the time taken to query the DB as part of an API call, the same GET request that takes 400ms query time on average in Cloud Run takes 2100ms in AppEngine.
To clarify this is the same source, same build deployed to both and these are the times once warm so I'm excluding the first few requests.

Cloud SQL, AppEngine and Cloud Run are all set up in the same region (australia-southeast1), and connection from GAE and Cloud Run to Cloud SQL is for both via Private IP and Serverless VPC.

I added OpenTelemetry and the pg plugin to diagnose the pg component and can see that it's saying the raw query is about 3.5x on average (160ms vs 550ms) . I'm assuming that "pg.query:SELECT" is execution time + fetching time, and the issue likely lies in the fetching rather than execution but can't see how with the OpenTelemetry plugin I can isolate that.
I also output the query being executed to cloud logs to ensure that it's the same query on both.

I'm going to try via Public IP to see if this is some sort of Private and VPC issue, although docs say Private IP should be faster. Any other thoughts/suggestions on what this could be? 

--
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/e82f9f71-e4e5-43b1-8457-1df29f525eddn%40googlegroups.com.

No comments:

Post a Comment