Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Functions Enviroments #140

Closed
kurtisvg opened this issue May 27, 2019 · 2 comments
Closed

Support for Functions Enviroments #140

kurtisvg opened this issue May 27, 2019 · 2 comments
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@kurtisvg
Copy link
Contributor

Add automatic use of the functions /cloudsql/ socket.

@kurtisvg
Copy link
Contributor Author

Currently the RSA pair is generated even when not needed (i.e. unix socket) - this is causing a big delay in the initial connection (likely similar to #53). We should figure out how to speed this up, or generate the key-pair asynchronously to prevent it from blocking until it needs to.

@hravnaas
Copy link

We are affected by this and here are some more details: I'm connecting from Cloud Functions for Java in us-central1 to Cloud SQL (postgres 11) in us-west1 using the socket factory. Everything works, but it takes around ~10 seconds to first obtain the connection, which is the problem. I am spanning two locations, but don't think it'd make that much of a difference. Here are the key log entries and the amount of time each one takes.

6 ms: INFO: Connecting to Cloud SQL instance [projectid:us-west1:instancename] via SSL socket.
7 sec: INFO: First Cloud SQL connection, generating RSA key pair
3 sec: INFO: Obtaining ephemeral certificate for Cloud SQL instance [projectid:us-west1:instancename]...
1 sec: INFO: Connecting to Cloud SQL instance [projectid:us-west1:instancename] on IP [public ip].

I have forced it to use a Unix socket via the environment variable, but it doesn't improve the situation, and most importantly, it still generates the RSA key pair, which takes up the majority of the time. We are using this with a UI app, and getting that SQL connection up as fast as possible is very important to us.

@kurtisvg kurtisvg added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed Type: Enhancement labels Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants