Wait, sorry I just realized you do still need some mechanism for pooling the connections (even if it doesn't automatically test for their health), so yeah hopefully Python folks can chime in with that.
On Thu, Aug 2, 2012 at 2:19 PM, Mauricio Aristizabal <[email protected]>wrote: > Richard, I do use a connection pool (Apache commons dbcp) but i'm on the > Java side so can't help you with specifics. The only wrinkle for me was > that I couldn't use the strategy where it checks connection health at > intervals because of the GAE thread limitations, so instead it has to do a > test query before every query, but in practice this ends up costing only > about 5ms (it's a fast query: "select 1"). > > Depending what you end up using though, you may be able to do without this > and instead trap error, get new connection and retry. If you setup a > monitoring ping to your app or a cron that results in a query always > happening before the 15m instance-inactive window then you can keep your > GCSQL instance up around the clock and then such stale connections will be > very rare. > > In fact since in your case there will only be a couple queries you might > just add this retry logic right into your app. Should be pretty simple, > just wait for wind down, see what exception is thrown, and trap that / > connect / retry. > > > On Thu, Aug 2, 2012 at 12:55 PM, alex <[email protected]> wrote: > >> As far as I understand, Google recommends closing connection right away, >> after you perform all operations. The latency to check whether a connection >> is still open is (almost?) the same as opening a new one, so it doesn't >> seem to be worth keeping it open. >> >> They also say a per-hour-usage db instance gets inactive after 15 min >> idle, and12 hours (if I remember correctly) forthe other plan (you pay flat >> per day). I've seen high latencies only on first connect to a "cold" db >> instance. You'll find more in the official docs. >> >> I liked it. Works better than I expected. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google App Engine" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/google-appengine/-/usXB3qS55KcJ. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-appengine?hl=en. >> >> > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
