connection-pooling

Deadlocks causing 'Server failed to resume the transaction' with NHibernate and distributed transactions

十年热恋 提交于 2019-12-05 14:47:55
问题 We are having an issue when using NHibernate with distributed transactions. Consider the following snippet: // // There is already an ambient distributed transaction // using(var scope = new TransactionScope()) { using(var session = _sessionFactory.OpenSession()) using(session.BeginTransaction()) { using(var cmd = new SqlCommand(_simpleUpdateQuery, (SqlConnection)session.Connection)) { cmd.ExecuteNonQuery(); } session.Save(new SomeEntity()); session.Transaction.Commit(); } scope.Complete(); }

Use Connection pool with Jedis

情到浓时终转凉″ 提交于 2019-12-05 13:35:36
I am using Jedis to connect with a Redis server in a REST service. When I am calling the web service I want to do operations like jedis.hmget , jedis.exits and hgetALL . For example: jedis.hmget("employee:data:" + emp_user_id, "employee_id").get(0); The configuration that I am using for Redis is: Jedis jedis; JedisShardInfo shardInfo; @PostConstruct public void init() { try { shardInfo = new JedisShardInfo(Config.getRedisHost(), Config.getRedisPort()); shardInfo.setPassword(Config.getRedisPassword()); jedis = new Jedis(shardInfo); jedis.select(2); //jedis.se } catch (Exception e) { logger

C3P0: unreturnedConnectionTimeout in production?

这一生的挚爱 提交于 2019-12-05 11:27:23
The parameter unreturnedConnectionTimeout times out unreturned connections after a given period of time. I'm trying to decide whether I should use this in my production persistence.xml ? A big plus of using this is that the Connection Pool will be able to recover from leaky connections. A big minus is that leaky connections will be very difficult to detect. Should I use unreturnedConnectionTimeout in production applications? If yes, what should its value be? Are there any other pros/cons I should consider? Steve Waldman You should debug your Connection leaks, and then not use

APPARENT DEADLOCK c3p0 0.9.5.1 spring

让人想犯罪 __ 提交于 2019-12-05 11:22:18
We are facing APPARENT DEADLOCK while using c3p0 0.9.5.1 ( which is latest version of c3p0). following is the connection pool config we are using. p:driverClass="${app.jdbc.driverClassReplica}" p:jdbcUrl="jdbc:mysql://database,database/dbname" p:acquireIncrement="5" p:idleConnectionTestPeriod="300" p:maxPoolSize="100" p:maxStatements="2000" p:minPoolSize="10" p:maxIdleTime="1800" p:maxConnectionAge="3600" p:maxIdleTimeExcessConnections="20" p:numHelperThreads="15" p:preferredTestQuery="SELECT 1"/> and Following are the logs ThreadPoolAsynchronousRunner:743---- com.mchange.v2.async

HBase HTablePool: correct usage

醉酒当歌 提交于 2019-12-05 10:59:22
What is the correct usage pattern of HTablePool? I mean, assume that I have my DAO which is initialised with an instance of HTablePool. This DAO is a member instance of a Stateless Session Bean so it is reused between invocations. What is the correct usage beween the following? private HTableInterface aTable; public XYZDAO(final HTablePool pool) { this.aTable = pool.getTable(...); } public void doSomething(...) { aTable.get(...) } or HTablePool should be used like a Datasource and therefore is more appropriate a usage like this private HTablePool datasource; public XYZDAO(final HTablePool pool

How to get detailed list of connections to database in sql server 2005?

一个人想着一个人 提交于 2019-12-05 10:06:33
问题 How to get detailed list of connections to database in sql server 2005? 回答1: Use the system stored procedure sp_who2 . 回答2: sp_who2 will actually provide a list of connections for the database server , not a database . To view connections for a single database (YourDatabaseName in this example), you can use DECLARE @AllConnections TABLE( SPID INT, Status VARCHAR(MAX), LOGIN VARCHAR(MAX), HostName VARCHAR(MAX), BlkBy VARCHAR(MAX), DBName VARCHAR(MAX), Command VARCHAR(MAX), CPUTime INT, DiskIO

where to store database string connection in java web app?

拥有回忆 提交于 2019-12-05 09:23:39
I'm about to begin my first project with java Let me tell how I used to handle these things... So far now, I've been workin on asp with a com+ componente made with VB6. The component is registered via the com+ administration console with a domain user, something lile my_company_domain\my_app_account The components reads the configuration from an udl file, configured to access the DB with integrated security. I invoke the componente from asp with server.createobject, the component runs with the specified domain account, and so every DB access runs with this account... What I like from this

How could I check the number of active sqlalchemy connections in a pool at any given time?

主宰稳场 提交于 2019-12-05 07:02:59
I have a situation where sqlalchemy keeps running out of active connections from time to time due to high traffic loads, and I would like to run some tests to verify and optimize the pooling parameters per our use case. However, I cannot find a straightforward way of polling for the count of active connections. Current setup is on the lines: args = ... mapping = { 'pool_size': 10, 'max_overflow': 10, 'pool_timeout': 30, 'pool_recycle': 1800 } engine = sqlalchemy.create_engine(*args, **mapping) The max connections on the MySQL server is set to 200 and there are about 20 web servers and celery

Why do connections persist when I undeploy a webapp using the Tomcat 7 JDBC connection pool?

偶尔善良 提交于 2019-12-05 06:58:02
I've got a minimal Spring webapp deployed to Tomcat 7.0.22 - it consists of a couple of pages, a controller, a service, and a DAO which has one method that runs a SELECT query. The webapp is configured to use the new Tomcat JDBC connection pool - here is the resource configuration in the webapp's context.xml: <Resource name="jdbc/myDB" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@blah blah" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" maxActive="15" initialSize="5" maxWait="40000" validationQuery="select 1 from dual"

Tomcat JDBC connection pool (releasing connection)

ε祈祈猫儿з 提交于 2019-12-05 05:25:26
Referring to Tomcat JBDC connection pool , I see in the standalone java example given there, one gets the connection using datasource.getConnection() which is cool. But in the finally block, it says con.close() . Question: When I implement this, it seems obvious that the con I get from datasource will be closed every time in the finally. When this is closed, will the connection pooling mechanism acquire a new connection and adds it to the pool? I presume there should be a method call like releaseConnection() that will let the pool take its own decision whether to close it or let it be open for