Wednesday, January 27, 2016

Re: [google-cloud-sql-discuss] Queries related to Cloud SQL concurrent connections and requests

Replies in-line:

On Tue, Jan 26, 2016 at 11:39 PM, Kartik Domadiya <kartik.domadiya@searce.com> wrote:
a) What is Pending Connection and how does it affect ?
        Not sure if this throws 1033 Instance has too many concurrent requests, when it exceeds 100. How do we handle this ? Is it like we can create 250 connections but use only 100 at a time ?
The key word here is "pending". This is really a limitation on the rate at which new connections can be opened. Due to our connection routing infrastructure we have a limit on the number of connections that can be in an internal startup phase at once.  As the FAQ explains: "Establishing a connection takes, on the server side, about 1.25 ms; because of the 100 pending connection limit, this means a maximum of 800 connection per second. If more than 100 clients try to connect simultaneously then some them will fail."

b) 250 Concurrent Connections.
        Should throw error Too Many Connections if it exceeds 250
This is correct. The key word here is "concurrent", as this is the number of connections that exist at a given moment, rather than anything to do with the rate at which they are opened.
 
c) Per app engine instance 12 concurrent connections per SQL Instance. How do we ensure that no more than 12 connections per app engine instance ? 
    Have gone through 
    But people face certain issues in that.
If you have one connection per request then you can ensure <= 12 connections per app engine instance by doing two things: (a) don't increase max-concurrent-requests above 12 and (b) ensuring you close db connections at the end of the request. If you use connection pooling, ensure you have less than 12 connections and they are closed cleanly when no longer used.
 
d) We got OperationalError: (2013, "Lost connection to MySQL server at 'reading initial communication packet', system error: 38") error when     we tried a test with 1000+ requests concurrently.
This error message occurs for lots of different problems. My guess is you are hitting the 100 pending connection limit. Try ensuring you open less than 800 connections per second (but you can keep them open >1s, allowing for >800 concurrent connections).

 
We have 1500+ people(as of now and it will grow) using our system concurrently and looks like it will fail. So we are just confused if we can use Cloud SQL due to the above mentioned issues. But solutions should be available though. 

If you are using D0 or D1 but reaching limits of your instance, try moving to a larger tier.  Also you can try Cloud SQL second generation instances (in beta) which have some better performance characteristics.

Yours,
David

--
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/CAJZK_bbgL5MC5-AUwAv301A8woVOfG0P34RpEuuzEnbcHtog8w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment