Bonjour à tous,

J'utilise c3p0-0.9.5.2.jar et mchange-commons-java-0.2.11.jar pour gérer la connexion, et j'utilise cette version de postgreSql 9.3.

Je reçois ces messages au moins une fois par jour dans mon environnement de production:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2017-12-05 12:23:47,418 ERROR [STDERR] (ajp-0.0.0.0-8010-149) Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
2017-12-05 12:23:47,418 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:118)
2017-12-05 12:23:47,418 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:692)
2017-12-05 12:23:47,418 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
2017-12-05 12:23:47,419 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
2017-12-05 12:23:47,419 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
2017-12-05 12:23:47,419 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	... 187 more
2017-12-05 12:23:47,419 ERROR [STDERR] (ajp-0.0.0.0-8010-149) Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
2017-12-05 12:23:47,419 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1469)
2017-12-05 12:23:47,420 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:644)
2017-12-05 12:23:47,420 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:554)
2017-12-05 12:23:47,420 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:758)
2017-12-05 12:23:47,420 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:685)
2017-12-05 12:23:47,420 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	... 190 more
2017-12-05 12:23:47,420 ERROR [STDERR] (ajp-0.0.0.0-8010-149) Caused by: org.postgresql.util.PSQLException: FATAL: remaining connection slots are reserved for non-replication superuser connections
2017-12-05 12:23:47,420 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	at org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:712)
2017-12-05 12:23:47,420 ERROR [STDERR] (ajp-0.0.0.0-8010-149) 	at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213)
j'ai cette configuration dans mon application :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
 
<beans>
         <bean id="dataSource" class = "com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
       <property name="driverClass" value="org.postgresql.Driver"/>
 
        <property name="jdbcUrl" value="jdbc:postgresql://localhost:5432/Test"/> 
 
        <property name="user" value="postgres"/>
        <property name="password" value="postgres"/>
           <!-- pool sizing -->
     <!-- pool sizing -->
        <property name="initialPoolSize" value="32" />
        <property name="minPoolSize" value="30" />
        <property name="maxPoolSize" value="300" />
        <property name="acquireIncrement" value="10" />
        <property name="maxStatements" value="0" />
 
        <!-- retries -->
        <property name="acquireRetryAttempts" value="30" />
        <property name="acquireRetryDelay" value="1000" /> <!-- 1s -->
        <property name="breakAfterAcquireFailure" value="false" />
 
        <!-- refreshing connections -->
        <property name="maxIdleTime" value="180" /> <!-- 3min -->
        <property name="maxConnectionAge" value="10" /> <!-- 1h -->
 
        <!-- timeouts and testing -->
        <property name="checkoutTimeout" value="0" /> <!-- 60s -->
        <property name="idleConnectionTestPeriod" value="60" /> <!-- 60 -->
        <property name="testConnectionOnCheckout" value="true" />
        <property name="preferredTestQuery" value="SELECT 1" />
        <property name="testConnectionOnCheckin" value="true" /> 
 
    </bean>
</beans>

dans le fichier postgresql.conf j'ai cette configuration :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
max_connections = 300
shared_buffers = 32GB
mon serveur a cette performance: 24 cpu, 256 Go de mémoire

le nombre d'utilisateurs utilisant l'application est d'environ 1300

est-ce qu'il y a quelqu'un qui peut m'aider à résoudre ce problème

Merci d'avance