这仅在系统处于负载状态时发生。至少它是值得注意的。
Postgres 8.3.14 JDK 1.6 Tomcat 6 机器有 7GB 内存
我注意到我的 postgres 数据目录也占用了我的整个高清。我有一个 100GB 驱动器上的 postgres,它会在几个小时内填满它。
我有 1000 万行,很多连接,主要是读取。
我现在注意到这一点,因为我的使用量在一夜之间增加了 10 倍。
shared_buffers = 2GB Effective_cache_size = 3GB 其他一切,如果几乎保持不变
21:56:59,736 调试 BasicResourcePool:1620 - 跟踪 com.mchange.v2.resourcepool.BasicResourcePool@176b9ea [托管:24,未使用:1,排除:0](例如 com.mchange.v2.c3p0.impl.NewPooledConnection@1c3dc66 ) 21:56:59,736 DEBUG BasicResourcePool:1620 - 跟踪 com.mchange.v2.resourcepool.BasicResourcePool@176b9ea [托管:24,未使用:1,排除:0](例如 com.mchange.v2.c3p0.impl.NewPooledConnection@ 1c3dc66) 21:56:59,736 DEBUG BasicResourcePool:1450 - 已完成对过期资源的检查。[com.mchange.v2.resourcepool.BasicResourcePool@176b9ea] 21:56:59,736 调试 BasicResourcePool:956 - 准备销毁资源:com.mchange.v2.c3p0.impl.NewPooledConnection@1e0a562 21:56:59,736 调试 C3P0PooledConnectionPool:468 - 准备销毁 PooledConnection:com.mchange.v2.c3p0.impl.NewPooledConnection@1e0a562 21:56:59,736 调试 NewPooledConnection:564 - com.mchange.v2.c3p0.impl.NewPooledConnection@1e0a562 被客户端关闭。java.lang.Exception:调试 -- 由 com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:564) 处的客户端堆栈跟踪关闭(com.mchange.v2.c3p0.impl.NewPooledConnection.close( NewPooledConnection.java:234) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470) at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:958)在 com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547) 21:56:59,736 DEBUG C3P0PooledConnectionPool:476 - 成功销毁 PooledConnection: com.mchange.v2.c3p0.impl。NewPooledConnection@1e0a562 21:56:59,736 调试 BasicResourcePool:961 - 成功销毁资源:com.mchange.v2.c3p0.impl.NewPooledConnection@1e0a562 21:56:59,737 调试 NewPooledConnection:430 - com.mchange.v2.c3p0.impl。 NewPooledConnection@1e0a562 处理一个 throwable。org.postgresql.util.PSQLException:发送到后端时发生 I/O 错误。在 org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283) 在 org.postgresql.jdbc2.AbstractJdbc2Statement.executeprocessResults(QueryExecutorImpl.java:1620) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) ... 58 更多 21:56:59,737 调试 SqlUtils:85 - 尝试将 SQLException 转换为 SQLException。不理它。[SQL状态:08006;错误代码:0] org.postgresql.util.PSQLException:发送到后端时发生 I/O 错误。在 org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283) 在 org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) 在 org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367) 在 org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:271) 在 com.mchange.v2.c3p0。 impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76) 在 org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) 在 org.hibernate.loader.Loader.getResultSet(Loader.java:1953) 在 org.hibernate .loader.Loader.doQuery(Loader.java:802) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274) at org.hibernate.loader.Loader.loadEntity(Loader.java:2037) at org. hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86) 在 org.hibernate.loader.entity。AbstractEntityLoader.load(AbstractEntityLoader.java:76) at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3268) at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496) at org .hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477) 在 org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227) 在 org.hibernate.event.def.DefaultLoadEventListener.lockAndLoad(DefaultLoadEventListener .java:403) 在 org.hibernate.impl.SessionImpl 中的 org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:155) 在 org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090) 中。在 org.hibernate.impl.SessionImpl 加载(SessionImpl.java:1061)。在 com.icon.sa.service.action.auser.ItemUpdateAction.pre(ItemUpdateAction. java:28) 在 com.icon.sa.service.action.BaseAction.perform(BaseAction.java:59) 在 com.icon.sa.ws.auser.ItemResource.update(ItemResource.java:43) 在 sun.reflect .GeneratedMethodAccessor299.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at com.sun.jersey.server.impl .model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:168) 在 com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher。dispatch(ResourceJavaMethodDispatcher.java:70) 在 com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:279) 在 com.sun.jersey.server.impl.uri.rules.SubLocatorRule。 com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(SubLocatorRule.java:121) 接受(SubLocatorRule.java:121) com.sun.jersey.server.impl.uri.rules.SubLocatorRule。在 com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(SubLocatorRule.java:121) 上接受(SubLocatorRule.java:121) 在 com.sun.jersey.server.impl.uri.rules.ResourceClassRule 上接受(RightHandPathRule.java:136)。在 com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(ResourceClassRule.java:86) 上接受(ResourceClassRule.java:86) 在 com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule 上接受(RightHandPathRule.java:136)。在 com.sun.jersey 接受(RootResourceClassesRule.java:74)。server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1357) 在 com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1289) 在 com.sun.jersey.server.impl。 application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1239) 在 com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1229) 在 com.sun.jersey.spi.container.servlet.WebComponent。 com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:497) 上的服务(WebComponent.java:420) com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer. java:684) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 在 org.apache.catalina.core.ApplicationFilterChain。internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache .catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 在 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :102) 在 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 在 org.apache.catalina.connector 的 org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:647)。 CoyoteAdapter.service(CoyoteAdapter.java:298) 在 org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:第864章.Thread.run(Thread.java:636) 引起:java.net.SocketException:套接字在 java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:146) 处关闭org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:135) 在 org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:104) 在 org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73)在 org.postgresql.core.v3.QueryExecutorImpl 的 org.postgresql.core.PGStream.ReceiveChar(PGStream.java:259)。processResults(QueryExecutorImpl.java:1620) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) ... 58 更多 21:56:59,738 调试 DefaultConnectionTester:126 - 测试连接以响应异常:org.postgresql.util.PSQLException:发送到后端时发生 I/O 错误。在 org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283) 在 org.postgresql.jdbc2.AbstractJdbc2Statement.executeprocessResults(QueryExecutorImpl.java:1620) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) ... 58 更多 21:56:59,738 调试 DefaultConnectionTester:194 - 连接 org.postgresql.jdbc4.Jdbc4Connection @3aca 默认系统表连接测试失败,出现异常!org.postgresql.util.PSQLException:发送到后端时发生 I/O 错误。在 org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283) 在 org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) 在 org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353) 在 org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252) 在 org.postgredb2.jdbc2.cbaseMeta getTables(AbstractJdbc2DatabaseMetaData.java:2062) 在 com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnectionNoQuery(DefaultConnectionTester.java:185) 在 com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:62)在 com.mchange.v2.c3p0.AbstractConnectionTester.statusOnException(AbstractConnectionTester.java:82) 在 com.mchange.v2.c3p0.impl 的 com.mchange.v2.c3p0.impl.DefaultConnectionTester.statusOnException(DefaultConnectionTester.java:143) .NewPooledConnection。handleThrowable(NewPooledConnection.java:437) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:93) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) at org.hibernate .loader.Loader.getResultSet(Loader.java:1953) at org.hibernate.loader.Loader.doQuery(Loader.java:802) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274) at org. hibernate.loader.Loader.loadEntity(Loader.java:2037) 在 org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86) 在 org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java: 76) 在 org.hibernate.event.def 的 org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3268)。DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496) at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227) at org .hibernate.event.def.DefaultLoadEventListener.lockAndLoad(DefaultLoadEventListener.java:403) 在 org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:155) 在 org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java :1090) 在 org.hibernate.impl.SessionImpl.load(SessionImpl.java:1061) 在 org.hibernate.impl.SessionImpl.load(SessionImpl.java:1050) 在 com.icon.sa.common.dm.dao。 BaseDao.findByIdLockedOrException(BaseDao.java:52) 在 com.icon.sa.service.action.auser.ItemUpdateAction.pre(ItemUpdateAction.java:28) 在 com.icon.sa.service.action.BaseAction.perform(BaseAction.java:59) 在 com.icon.sa.ws.auser.ItemResource.update(ItemResource.java:43) 在 sun.reflect .GeneratedMethodAccessor299.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at com.sun.jersey.server.impl .model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:168) 在 com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:70) 在 com.sun .jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:279) 在 com.sun.jersey.server.impl.uri.rules.SubLocatorRule。com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(SubLocatorRule.java:121) 接受(SubLocatorRule.java:121) com.sun.jersey.server.impl.uri.rules.SubLocatorRule。在 com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(SubLocatorRule.java:121) 上接受(SubLocatorRule.java:121) 在 com.sun.jersey.server.impl.uri.rules.ResourceClassRule 上接受(RightHandPathRule.java:136)。在 com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(ResourceClassRule.java:86) 上接受(ResourceClassRule.java:86) 在 com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule 上接受(RightHandPathRule.java:136)。在 com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1357) 在 com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.爪哇:1289) 在 com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1239) 在 com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1229) 在 com .sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420) 在 com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:497) 在 com.sun.jersey .spi.container.servlet.ServletContainer.service(ServletContainer.java:684) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java :290) 在 org.apache.catalina.core.StandardWrapperValve 的 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)。在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 调用(StandardWrapperValve.java:233) .catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:647) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :109) 在 org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864) 在 org.apache.coyote.http11 的 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)。 Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579) 在 org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665) 在 java。lang.Thread.run(Thread.java:636) 原因:java.io.IOException: Stream closed at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder.java:44) at sun.nio.cs.StreamEncoder.flush (StreamEncoder.java:139) 在 java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229) 在 org.postgresql.core.PGStream.flush(PGStream.java:507) 在 org.postgresql.core.v3.QueryExecutorImpl。 sendSync(QueryExecutorImpl.java:1107) 在 org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:256) ... 64 更多在 org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:256) 的 org.postgresql.core.v3.QueryExecutorImpl.sendSync(QueryExecutorImpl.java:1107) 的 flush(PGStream.java:507) ... 64更多的在 org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:256) 的 org.postgresql.core.v3.QueryExecutorImpl.sendSync(QueryExecutorImpl.java:1107) 的 flush(PGStream.java:507) ... 64更多的
这是我的配置
<property name="c3p0.acquire_increment">1</property>
<property name="c3p0.idle_test_period">100</property> <!-- seconds -->
<property name="c3p0.max_size">250</property>
<property name="c3p0.max_statements">0</property>
<property name="c3p0.min_size">10</property>
<property name="c3p0.timeout">100</property> <!-- seconds -->
<!-- Configuring Connection Testing -->
<!-- Create a test table to query for on checkout and checkin. A test table
is faster than to use the getTables default cmd. -->
<property name="automaticTestTable">c3p0_test</property>
<property name="checkoutTimeout">0</property>
<!-- This tests to make sure the connection is still valid (needed for high load system). -->
<property name="testConnectionOnCheckout">true</property>
<property name="testConnectionOnCheckin">true</property>
<!-- Configuring Recovery From Database Outages -->
<property name="acquireRetryAttempts">0</property>
<property name="acquireRetryDelay">1000</property>
<property name="breakAfterAcquireFailure">false</property>
<!-- This is a safeguard to cleanup any open, abandoned connections.
These are connections that are opened but never closed. Debug on server if this ever needs
to cleanup.
We can test without this feature (its discouraged to use) -->
<property name="unreturnedConnectionTimeout">300</property>
<property name="debugUnreturnedConnectionStackTraces">true</property>