SQLite/C# Connection Pooling and Prepared Statement Confusion

It helps to remember that both connection pooling and prepared (compiled) statements are just tools that have their limits and no approach can be equally suitable to all possible situations. With this in mind, let’s remember when one might want to use connection pooling and prepared statements. Possible Reasons to Use Connection Pooling Connection pooling … Read more

Best configuration of c3p0 [closed]

This is a configuration I am using which keeps resources to a minimum. Of course you’ll want to tailor your application to use the resources it needs… Reference: http://www.mchange.com/projects/c3p0/index.html testConnectionOnCheckin validates the connection when it is returned to the pool. testConnectionOnCheckOut, although would ensure active connections before use, would be too expensive to do. idleConnectionTestPeriod … Read more

what is the use of the pool option in database.yml

It sets the amount of possible connections per ruby process. So in case you are threading your rails app, or you use transactions excessively. The limits here depend on your setup. Consider this: 50 ruby processes each with 100 threads a mysql with a setting of 1000 simultaneous connections so it makes sense that every … Read more

What is the best solution for database connection pooling in python?

In MySQL? I’d say don’t bother with the connection pooling. They’re often a source of trouble and with MySQL they’re not going to bring you the performance advantage you’re hoping for. This road may be a lot of effort to follow–politically–because there’s so much best practices hand waving and textbook verbiage in this space about … Read more

Springs RestTemplate default connection pool

Yes, Spring RestTemplateBuilder uses Apache HttpClient for pooling (usage). RestTemplateBuilder creates HttpComponentsClientHttpRequestFactory and uses HttpClientBuilder. HttpClientBuilder, by default, sets pool size per route (host) to 5 and total pool size to 10 (source): s = System.getProperty(“http.maxConnections”, “5”); int max = Integer.parseInt(s); poolingmgr.setDefaultMaxPerRoute(max); poolingmgr.setMaxTotal(2 * max); To check connection pool logging set logging level as follows: … Read more

Is the Session object from Python’s Requests library thread safe?

After reviewing the source of requests.session, I’m going to say the session object might be thread-safe, depending on the implementation of CookieJar being used. Session.prepare_request reads from self.cookies, and Session.send calls extract_cookies_to_jar(self.cookies, …), and that calls jar.extract_cookies(…) (jar being self.cookies in this case). The source for Python 2.7’s cookielib acquires a lock (threading.RLock) while it … Read more

Why do I constantly see “Resetting dropped connection” when uploading data to my database?

Requests uses Keep-Alive by default. Resetting dropped connection, from my understanding, means a connection that should be alive was dropped somehow. Possible reasons are: Server doesn’t support Keep-Alive. There’s no data transfer in established connections for a while, so server drops connections. See https://stackoverflow.com/a/25239947/2142577 for more details.