Monday, November 2, 2020

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

Jon,

I'm connecting AppEngine (Flexible) to CloudSQL (Postgresql) and don't have issues like you are reporting. Ours is a Python / Django app, though, and I'm using unix sockets to connect...

# In the flexible environment, you connect to CloudSQL using a unix socket.
# Locally, you can use the CloudSQL proxy to proxy a localhost connection
# to the instance

if os.getenv('GAE_INSTANCE'):
    DATABASES['default']['HOST'] = '/cloudsql/' + GC_DB_HOST
    DATABASES['default']['PORT'] = GC_DB_PORT

Here's a NestJS project that's using CloudSQL from AppEngine using sockets similarly: https://gitlab.com/wuesteon/star-wars-backend

Peter

On Mon, Nov 2, 2020 at 4:22 PM Jon Middleton <jonmiddleton.work@gmail.com> wrote:
I wouldn't say assisted, and I replied with further detail. It's still a general discussion at this point, I'm asking if in general people know if AppEngine takes longer to connect to Cloud SQL than Cloud Run does, or if there are large discrepancies between other google products and Cloud SQL.
I assume by the lack of responses and similar threads in the past with a lack of responses there's something else going on here.

On Tuesday, November 3, 2020 at 6:48:01 AM UTC+11 Mohammad I (Cloud Platform Support) wrote:

It appears that you also reported similar issues here where a Google Cloud Platform support agent already assisted you.  

In case still there are any technical issues or you would like to request any feature you can report it at the Public Issues by selecting the right component here

Please also note that Google Groups forum is meant for general discussion of the platform, not specific technical issues. You can find more info about Community Support Overview on Google Groups here.



On Friday, October 30, 2020 at 10:24:38 AM UTC-4 jonmiddl...@gmail.com wrote:
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/8125db51-2eb9-49d5-af00-5d22fe0f5aa7n%40googlegroups.com.

--
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/CAC%2B%3DFfYuEX0kvjKm-9xwWo4tawLdAaQtcrtM%2BA3y8Wt2bD1WVQ%40mail.gmail.com.

No comments:

Post a Comment