Re: Tomcat DBCP Connection pool issue
On 6/27/2012 8:35 PM, Christopher Schultz wrote: 100 active db connections sounds like a lot. Do you really need to support 100 simultaneous connections to your database? Can your database support that many connections with active queries from each? Do you have a cluster? Remember that each member in the cluster will therefore open a maximum of 100 connections to your database. 10 cluster members means 1000 simultaneous connections. to begin with I am targetting 1000 users at any time.I know this is too much to dream off.But again let me try for that. I will enable abondered detection settings.Thanks for bringing to notice. There's no time like the present: this problem will only get worse over time. I had written a bunch of DAO classes sometimes back,but there was bug in DB design(for one functionality,I forgot to relate tables properly) and after fixing that I somehow forgot to to use model 2 design(again my bad its hard to wire the brain to work this way when you can just make easy calls and then present data to the client and yet do MVC) and started working old way and due to this db calls went into the servlet.For other module I am fixing this and will make action servlet which will read request uri and then do the appropriate action.I have almost visualised,inserts and deletes.Trying to find the way to see how to make edit work.I have around 10 images and around 10 fields which I need to perists somewhere before final insert. God bless me. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat DBCP Connection pool issue
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kiran, On 6/26/12 7:24 PM, Kiran Badi wrote: Resource name=jdbc/mysitedb auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 100 active db connections sounds like a lot. Do you really need to support 100 simultaneous connections to your database? Can your database support that many connections with active queries from each? Do you have a cluster? Remember that each member in the cluster will therefore open a maximum of 100 connections to your database. 10 cluster members means 1000 simultaneous connections. I had a bug in my code and I was not closing connection, I fixed it and now this is working fine. You should enable abandoned detection and logging. an architectural comment: it's probably not a great idea to obtain a database connection directly from your Servlet. Doing so likely ties your business logic directly to both the servlet API *and* the JDBC API. If you want to switch to some other data source (e.g. a non-JDBC-supported data source like MongoDB, Cassandra, etc.), then you have to re-write your whole app. If you want to support Websocket, then you have to completely re-write your webapp. If you want to create an Android or Swing-based version, you have to completely re-write your app. See the pattern here? I know existing design is somewhat a kind of limitation,but again at this point ,its just to hard to implement this change. Let me think over this.It will take sometime. There's no time like the present: this problem will only get worse over time. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/rISAACgkQ9CaO5/Lv0PC8MwCeMVv+gx6x4ItxZspgJwI0e2km 458An0CPoRxJQBmh/AKRQFo4o64ByJZE =eQp9 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat DBCP Connection pool issue
在 2012-6-26,13:11,Kiran Badi ki...@poonam.org 写道: Hi All, While testing the pagination links ,I am getting below error, SEVERE: null org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at indianads.getServicesTourDetail.doGet(getServicesTourDetail.java:106) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) Was able to get connection at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: java.util.NoSuchElementException: Timeout waiting for idle object at org.apache.tomcat.dbcp.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1144) at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106) ... 24 more Where should I look to see as how many connection are establised on the DB side and how many I have still that I can use ? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org You can use java jmx console to monitor the number of db connections. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat DBCP Connection pool issue
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kiran, On 6/26/12 1:11 AM, Kiran Badi wrote: While testing the pagination links ,I am getting below error, SEVERE: null org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object Probably waited too long for a connection. What does your pool configuration look like? Look in META-INF/context.xml or, I suppose, in conf/server.xml for Resource elements. at org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:114) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at indianads.getServicesTourDetail.doGet(getServicesTourDetail.java:106) Just an architectural comment: it's probably not a great idea to obtain a database connection directly from your Servlet. Doing so likely ties your business logic directly to both the servlet API *and* the JDBC API. If you want to switch to some other data source (e.g. a non-JDBC-supported data source like MongoDB, Cassandra, etc.), then you have to re-write your whole app. If you want to support Websocket, then you have to completely re-write your webapp. If you want to create an Android or Swing-based version, you have to completely re-write your app. See the pattern here? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk/qFD4ACgkQ9CaO5/Lv0PBh0QCgiXqoY7K4LhV2nKqlmTbG5bri VPAAnjdS/a7ZF8CAoJ85VE+AoXMmDQ1q =73J6 -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat DBCP Connection pool issue
On 6/26/2012 12:09 PM, Steven Sinclair wrote: You can use java jmx console to monitor the number of db connections. Thanks Steven, I will check this.Actually servlet was leaking connection and I had forgot to close connection.Fixed it now. But I still need to monitor DB side.I will check jmx console. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat DBCP Connection pool issue
Probably waited too long for a connection. What does your pool configuration look like? Look in META-INF/context.xml or, I suppose, in conf/server.xml for Resource elements. Resource name=jdbc/mysitedb auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=user password=xxx driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/mysitedb/ This is my configuration in context.xml Chris. I had a bug in my code and I was not closing connection, I fixed it and now this is working fine. an architectural comment: it's probably not a great idea to obtain a database connection directly from your Servlet. Doing so likely ties your business logic directly to both the servlet API *and* the JDBC API. If you want to switch to some other data source (e.g. a non-JDBC-supported data source like MongoDB, Cassandra, etc.), then you have to re-write your whole app. If you want to support Websocket, then you have to completely re-write your webapp. If you want to create an Android or Swing-based version, you have to completely re-write your app. See the pattern here? I know existing design is somewhat a kind of limitation,but again at this point ,its just to hard to implement this change. Let me think over this.It will take sometime. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org