connection-pooling

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

北战南征 提交于 2019-12-03 10:24:41
I'm uploading hundreds of millions of items to my database via a REST API from a cloud server on Heroku to a database in AWS EC2. I'm using Python and I am constantly seeing the following INFO log message in the logs. [requests.packages.urllib3.connectionpool] [INFO] Resetting dropped connection: <hostname> This "resetting of the dropped connection" seems to take many seconds (sometimes 30+ sec) before my code continues to execute again. Firstly what exactly is happening here and why? Secondly is there a way to stop the connection from dropping so that I am able to upload data faster? Thanks

SQL Server connection pool doesn't detect closed connections?

守給你的承諾、 提交于 2019-12-03 10:03:11
For years, I've experienced very weird problems on all my web applications that connect to a SQL server. The problem is that if something happens to the database server (server restart or other problem), de web app stops working from that point on, even if the database server is alive and well afterwards. What happens is that every ADO.NET operation (ExecuteNonQuery, CreateReader, BeginTransaction, ...) fails with a InvalidOperationException : " Invalid operation. The connection is closed ". It seems that a call to SqlConnection.Open() retrieves a connection from the application pool which is.

JBoss Database Connection Pool

本秂侑毒 提交于 2019-12-03 09:53:25
问题 I am new to jboss and i have been asked to incorporate jboss connection pooling mechanism with an existing web application. Considering that a web application database layer is properly written i.e. all resultsets, statements and connections being closed properly when not needed, What all code changes i will have to make in my web app after i have configured the jboss datasource properly. Can anybody please point me to a tutorial or a code sample which uses jboss datasource in a web app. 回答1:

Using Django ORM in threads and avoiding “too many clients” exception by using BoundedSemaphore

本秂侑毒 提交于 2019-12-03 08:26:34
问题 I work on manage.py command which creates about 200 threads to check remote hosts. My database setup allows me to use 120 connections, so I need to use some kind of pooling. I've tried using separated thread, like this class Pool(Thread): def __init__(self): Thread.__init__(self) self.semaphore = threading.BoundedSemaphore(10) def give(self, trackers): self.semaphore.acquire() data = ... some ORM (not lazy, query triggered here) ... self.semaphore.release() return data I pass instance of this

Spring Connection Pooling [closed]

亡梦爱人 提交于 2019-12-03 08:24:35
Can someone tell me or point me to a document/tutorial that explains how to use connection pooling in Spring? Gaurav Spring doesn't support inbuilt pooling. You should use a third party pool as mentioned above. DBCP and c3p0 both work like a charm with spring. All you need to do is when defining a datasource in your context.xml, just use DBCP to define it. You might use a pooled datasource from the jdbc driver. E.g. in oracles library there is one: <bean id="dataSource" class="oracle.jdbc.pool.OracleConnectionPoolDataSource"> <property name="URL" value="jdbc:oracle:thin:@wherever:1234:whatever

What is the difference between a Session and a Connection in Hibernate?

亡梦爱人 提交于 2019-12-03 07:30:02
问题 I want to clear the basic 3 points, Does beginning a new database transaction on an old session obtains a new connection and resumes the session? Does committing a database transaction disconnects a session from the JDBC connection and returns the connection to the pool? From Hibernate Documentation, earlier versions of Hibernate required explicit disconnection and reconnection of a Session. These methods are deprecated, asbeginning and ending a transaction has the same effect. How do they

Java Connection Pooling best practices?

安稳与你 提交于 2019-12-03 07:14:42
问题 After getting fed up with c3p0's constant locking I'm turning to BoneCP for an alternative connection pool for my database. I have a server app that processes around 7,000 items per minute and needs to log those items into our MySQL database. I currently have 100 worker threads and have set up my pool like such: BoneCPConfig config = new BoneCPConfig(); config.setJdbcUrl("jdbc:mysql://"+Settings.MYSQL_HOSTNAME+"/"+Settings.MYSQL_DATABASE+"?autoReconnectForPools=true" ); config.setUsername

Thinking behind decision of database connection pool size

江枫思渺然 提交于 2019-12-03 07:11:49
问题 i am working on opensource java based application i.e xwiki. Insie hibernate.cfg.xml i can see value of parametrs connection.pool_size and statement_cache.siz as 2(for each). My application will be having maximum load of 100 users at point of time. Now my question is what should be ideal connection pool size for this. To me size 2 looks very less. If 100 users connect at a time 98 users have to wait for grtting the connection released? Should i keep the connection pool size as 100 in my case?

Python mysql (using pymysql) auto reconnect

落花浮王杯 提交于 2019-12-03 06:47:29
I'm not sure if this is possible, but I'm looking for a way to reconnect to mysql database when the connection is lost. All the connections are held in a gevent queue but that shouldn't matter I think. I'm sure if I put some time in, I can come up with a way to reconnect to the database. However I was glancing pymysql code and I saw that there is a 'ping' method in Connection class, which I'm not sure exactly how to use. The method looks like it will reconnect first time but after that it switched the reconnect flag to False again? Can I use this method, or is there a different way to

Concurrent DB connection pool in Haskell

女生的网名这么多〃 提交于 2019-12-03 06:12:06
I am a Java programmer who learns Haskell. I work on a small web-app that uses Happstack and talks to a database via HDBC. I've written select and exec functions and I use them like this: module Main where import Control.Exception (throw) import Database.HDBC import Database.HDBC.Sqlite3 -- just for this example, I use MySQL in production main = do exec "CREATE TABLE IF NOT EXISTS users (name VARCHAR(80) NOT NULL)" [] exec "INSERT INTO users VALUES ('John')" [] exec "INSERT INTO users VALUES ('Rick')" [] rows <- select "SELECT name FROM users" [] let toS x = (fromSql x)::String let names = map