I have an app (Python 2.7, App Engine standard, EU region) which uses 
CloudSQL to store some low-volume data (like user profiles). Unfortunately 
CloudSQL has two limitations with regards to the maximum number of 
connections:

- a global limit of 4000 (https://cloud.google.com/sql/faq - for 
second-generation instances)
- a per instance limit of 12 (from the same URL as above - "Each App Engine 
instance running in a standard environment cannot have more than 12 
concurrent connections to a Google Cloud SQL instance")

To make sure that I respect this I can take two approaches, neither of them 
foolproof:

- use frontend (F) instances with automatic scaling and set 
"max_concurrent_requests" sufficiently low. This solves the second issue, 
but if there are sufficient requests such that GAE scales my app to many 
instances, I can break the global connection limit (and there is no 
"max_num_instances" or something similar for the auto scaler)
- use backaend (B) instances where I can specify "max_instances", however I 
don't know how many requests are routed to one instance (when "threadsafe: 
true" is set in app.yaml) - though I suspect not many - and I frequently 
get the "Request was aborted after waiting too long to attempt to service 
your request." error because I have too few instances (I'm running in the 
EU region so can't start more than 25 instances with the basic scaler :( ).

One quick hack would be to use the backend instances but also run multiple 
services (like backend0, backend1, backend2, etc) and have the client 
randomly pick one (I control both the server and the client) to work around 
the 25 instance / service limit, however that feels very much like a hack 
:(.

-- 
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/c592b594-fc9e-4ff1-a7e2-6b7e1728d64c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine]... Attila-Mihaly Balazs
    • [google-appen... 'Nicholas (Google Cloud Support)' via Google App Engine
      • Re: [goog... Jeff Schnitzer
        • Re: [... 'Alex Martelli' via Google App Engine
          • R... Attila-Mihaly Balazs
            • ... 'Alex Martelli' via Google App Engine
              • ... Attila-Mihaly Balazs

Reply via email to