Hey Nick,
Sorry for the late reply, both my CloudSQL and App Engine are in the same
project, which is located in northeast-asia. I am connecting through PHP
using mysqli, and I've tried PDO and I am getting the same result.
Interestingly, when I connect through host:port, I am getting a lot lower
latency. I have whitelisted 0.0.0.0/0 for IP and using host:port connection
and I am getting a pretty low latency (I know it's not secure). Which is
weird, because unix socket should be a lot faster. Here is my code for both
type of connection:
YAML :
MYSQL_DSN: /cloudsql/projectname:asia-northeast1:instancename
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_DATABASE: dbname
Using socket:
$servername = getenv('MYSQL_DSN');
$username = getenv('MYSQL_USER');
$password = getenv('MYSQL_PASSWORD');
$dbname = getenv('MYSQL_DATABASE');
$connection = new mysqli(null, $username, $password, $dbname, null,
$servername);
Using host:port :
$servername = "ip.address:port";
$username = getenv('MYSQL_USER');
$password = getenv('MYSQL_PASSWORD');
$dbname = getenv('MYSQL_DATABASE');
$connection = new mysqli($servername, $username, $password, $dbname);
Please let me know if you can tell what's wrong! Thank you very much.
On Wednesday, December 21, 2016 at 5:39:43 AM UTC+8, Nick (Cloud Platform
Support) wrote:
>
> Hey Andy,
>
> Let us know if you can get some of those details to us. We'd be happy to
> take a look into further investigating a possible cause.
>
> Cheers,
>
> Nick
> Cloud Platform Community Support
>
> On Wednesday, December 14, 2016 at 8:47:06 AM UTC-5, Andy Tseng wrote:
>>
>> So I am connecting to Second Gen Cloud SQL from my App Engine, and both
>> of them are in the same project. However, the latency is really high, up to
>> 1.3 seconds. So I was wondering if anyone else is also running into this
>> problem. Everything works fine, but it's just the high latency and the same
>> structure at AWS has a much shorter latency, so I was wondering why.
>>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/4e20bbff-b488-479a-b3b7-c85b43fff77d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.