Author: eric
Date: Fri Jan 27 04:31:59 2012
New Revision: 1236522
URL: http://svn.apache.org/viewvc?rev=1236522&view=rev
Log:
Tune JPA datasource for timeout,... - Contributed by Michael Herrmann
(JAMES-1317)
Modified:
james/app/trunk/src/main/resources/META-INF/org/apache/james/spring-server.xml
Modified:
james/app/trunk/src/main/resources/META-INF/org/apache/james/spring-server.xml
URL:
http://svn.apache.org/viewvc/james/app/trunk/src/main/resources/META-INF/org/apache/james/spring-server.xml?rev=1236522&r1=1236521&r2=1236522&view=diff
==============================================================================
---
james/app/trunk/src/main/resources/META-INF/org/apache/james/spring-server.xml
(original)
+++
james/app/trunk/src/main/resources/META-INF/org/apache/james/spring-server.xml
Fri Jan 27 04:31:59 2012
@@ -315,6 +315,22 @@
<property name="url" value="${database.url}" />
<property name="username" value="${database.username}" />
<property name="password" value="${database.password}" />
+ <!--The value for maxActive should always be larger than the number of
spooler threads. The-->
+ <!--reason is that a spooler thread normally requires 1 connection to
process a mail, however-->
+ <!--sometimes OpenJPA requires 1 connection to finish the processing
on top of that. If-->
+ <!-- maxActive <= num spooler threads,-->
+ <!--it can happen that the spooler threads grab all maxActive
connections but then cannot-->
+ <!--finish processing because each of them blocks waiting for OpenJPA
which itself is waiting-->
+ <!--for a connection. See
https://issues.apache.org/jira/browse/JAMES-1317.-->
+ <property name="maxActive" value="21"/>
+ <!-- This lets a mail fail to be processed rather than the server
freezing. -->
+ <property name="maxWait" value="30000"/>
+ <!-- This keeps the number of connections in the pool low on average
-->
+ <property name="timeBetweenEvictionRunsMillis" value="300000"/>
+ <property name="minEvictableIdleTimeMillis" value="300000"/>
+ <property name="removeAbandoned" value="true"/>
+ <property name="logAbandoned" value="true"/>
+ <property name="removeAbandonedTimeout" value="300"/>
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="datasource"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]