Hey Andy,

Thanks for that information. I'm currently working on reproducing the 
behaviour, although I'm not seeing it so far. It may be related to the App 
Engine app's location. Are you sure your app's instances are in 
asia-northeast1? 

Also, this is speculation and I'll have to confirm, but perhaps there's 
something odd happening with the resolution of the SQL instances' location 
/ routing of packets when using the unix socket (which is of course an 
abstraction rather than a mere socket to a db process running on the local 
"machine") while the more direct IP route is avoiding that. 

I'll get back to you as soon as I can with more clarity on this. In the 
meantime, it's good to know the IP workaround is efficient.

Cheers,

Nick
Cloud Platform Community Support

On Friday, December 23, 2016 at 3:11:43 AM UTC-5, Andy Tseng wrote:
>
> 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 google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
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/c2e82b4b-f678-48f4-bf59-56ff8d785239%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to