本文地址:http://blog.csdn.net/kongxx/article/details/7176961
最近在对Vertica做压力测试的时候,发现当并发请求数达到50+的时候就会出现下面的异常
- com.vertica.util.PSQLException: FATAL: New session rejected due to limit, already 55 sessions active
- at com.vertica.core.v3.ConnectionFactoryImpl.readStartupMessages(Unknown Source)
- at com.vertica.core.v3.ConnectionFactoryImpl.openConnectionImpl(Unknown Source)
- at com.vertica.core.ConnectionFactory.openConnection(Unknown Source)
- at com.vertica.jdbc2.AbstractJdbc2Connection.<init>(Unknown Source)
- at com.vertica.jdbc3.AbstractJdbc3Connection.<init>(Unknown Source)
- at com.vertica.jdbc3g.Jdbc3gConnection.<init>(Unknown Source)
- at com.vertica.Driver.makeConnection(Unknown Source)
- at com.vertica.Driver.connect(Unknown Source)
- at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
- at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
- at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1181)
- at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
- at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
- at DBUtil.getConnection(DBUtil.java:64)
- at DBQueryPerformanceTest.query(DBQueryPerformanceTest.java:46)
- at DBQueryPerformanceTest.access$000(DBQueryPerformanceTest.java:14)
- at DBQueryPerformanceTest$1.execute(DBQueryPerformanceTest.java:40)
- at DBPerformanceTest.runIt(DBPerformanceTest.java:97)
- at DBPerformanceTest$1.run(DBPerformanceTest.java:51)
- at java.lang.Thread.run(Thread.java:619)
- com.vertica.util.PSQLException: The connection attempt failed.
- at com.vertica.core.v3.ConnectionFactoryImpl.openConnectionImpl(Unknown Source)
- at com.vertica.core.ConnectionFactory.openConnection(Unknown Source)
- at com.vertica.jdbc2.AbstractJdbc2Connection.<init>(Unknown Source)
- at com.vertica.jdbc3.AbstractJdbc3Connection.<init>(Unknown Source)
- at com.vertica.jdbc3g.Jdbc3gConnection.<init>(Unknown Source)
- at com.vertica.Driver.makeConnection(Unknown Source)
- at com.vertica.Driver.connect(Unknown Source)
- at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
- at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
- at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1181)
- at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
- at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
- at DBUtil.getConnection(DBUtil.java:64)
- at DBQueryPerformanceTest.query(DBQueryPerformanceTest.java:46)
- at DBQueryPerformanceTest.access$000(DBQueryPerformanceTest.java:14)
- at DBQueryPerformanceTest$1.execute(DBQueryPerformanceTest.java:40)
- at DBPerformanceTest.runIt(DBPerformanceTest.java:97)
- at DBPerformanceTest$1.run(DBPerformanceTest.java:51)
- at java.lang.Thread.run(Thread.java:619)
- Caused by: java.net.SocketException: Connection reset
- at java.net.SocketInputStream.read(SocketInputStream.java:168)
- at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
- at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
- at com.vertica.core.PGStream.ReceiveChar(Unknown Source)
- at com.vertica.core.v3.ConnectionFactoryImpl.doAuthentication(Unknown Source)
- … 19 more
出现这个问题是由于Vertica中指定了MaxClientSessions参数,此时可以通过下面的SQL来修改此值
- <pre name=“code” class=“sql”>SELECT SET_CONFIG_PARAMETER (‘MaxClientSessions’, 250);</pre><br>
- <br>
- <pre></pre>
- <p></p>
- <pre></pre>
- <br>
- <br>
- <p></p>
- <p><br>
- </p>
- <p><br>
- </p>