Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Connection Pooling

    Isomorphic,

    We are looking at connection pooling and have the following questions :

    1) the Stack trace to get Oracle connection is show below:

    Code:
    oracle.jdbc.pool.OracleDataSource.getConnection()
    com.isomorphic.sql.PoolableSQLConnectionFactory.makeUnpooledObject()
    com.isomorphic.sql.PoolableSQLConnectionFactory.makeObject()
    org.apache.commons.pool.impl.GenericObjectPool.borrowObject()
    com.isomorphic.pool.PoolManager.borrowObject(Object, DSRequest)
    com.isomorphic.sql.SQLConnectionManager.getConnection(String)
    com.isomorphic.sql.SQLDriver.getTransformedResults(String, Connection, String, SQLDriver, List, Map, DSRequest, DSResponse)
    com.isomorphic.sql.SQLDriver.executeQuery(String, List, Map, DSRequest, DSResponse)
    com.isomorphic.sql.SQLDataSource.executeNativeQuery(String, List, Map, DSRequest, DSResponse)
    com.isomorphic.sql.SQLDataSource.executeNativeQuery(String, DataSource, Map, DSRequest, DSResponse)
    com.isomorphic.sql.SQLDataSource.SQLExecute(DSRequest, Object)
    com.isomorphic.sql.SQLDataSource.processRequest(DSRequest)
    com.isomorphic.sql.SQLDataSource.executeFetch(DSRequest)
    com.isomorphic.datasource.DataSource.execute(DSRequest)
    com.isomorphic.application.AppBase.executeDefaultDSOperation()
    com.isomorphic.application.AppBase.executeAppOperation()
    com.isomorphic.application.AppBase.execute(DSRequest, RequestContext)
    com.isomorphic.datasource.DSRequest.execute()
    com.isomorphic.servlet.IDACall.handleDSRequest(DSRequest, RPCManager, RequestContext)
    com.isomorphic.servlet.IDACall.processRPCTransaction(RPCManager, RequestContext)
    com.isomorphic.servlet.IDACall.processRequest(HttpServletRequest, HttpServletResponse)
    com.isomorphic.servlet.IDACall.doPost(HttpServletRequest, HttpServletResponse)
    javax.servlet.http.HttpServlet.service(HttpServletRequest, HttpServletResponse)
    com.isomorphic.servlet.BaseServlet.service(HttpServletRequest, HttpServletResponse)
    javax.servlet.http.HttpServlet.service(ServletRequest, ServletResponse)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
    com.isomorphic.servlet.CompressionFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
    org.apache.catalina.core.StandardWrapperValve.invoke(Request, Response)
    org.apache.catalina.core.StandardContextValve.invoke(Request, Response)
    org.apache.catalina.core.StandardHostValve.invoke(Request, Response)
    org.apache.catalina.valves.ErrorReportValve.invoke(Request, Response)
    org.apache.catalina.core.StandardEngineValve.invoke(Request, Response)
    org.apache.catalina.connector.CoyoteAdapter.service(Request, Response)
    org.apache.coyote.http11.Http11AprProcessor.process(long)
    org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(long)
    org.apache.tomcat.util.net.AprEndpoint$Worker.run()
    java.lang.Thread.run()
    I see the following call: com.isomorphic.sql.PoolableSQLConnectionFactory.makeUnpooledObject()

    so is it returning a pooled connection or not? However in logs I see the following statement:

    Code:
    DEBUG PoolableSQLConnectionFactory - [builtinApplication.thumbNailInfo] Returning pooled Connection
    Also the endStack for the connection is as follows:

    Code:
    oracle.jdbc.driver.PhysicalConnection.close()
    org.apache.commons.dbcp.DelegatingConnection.close()
    org.apache.commons.dbcp.PoolableConnection.reallyClose()
    com.isomorphic.sql.SQLConnectionManager.free(Connection)
    com.isomorphic.sql.SQLDriver.freeConnection()
    com.isomorphic.sql.SQLDriver.clearState()
    com.isomorphic.sql.SQLDataSource.clearState()
    com.isomorphic.datasource.PoolableDataSourceFactory.destroyObject(Object, Object)
    com.isomorphic.pool.PoolManager.returnObject(Object, Object)
    com.isomorphic.datasource.DataSourceManager.free(DataSource)
    com.isomorphic.datasource.DataSource.freeResources(DSRequest)
    com.isomorphic.sql.SQLDataSource.freeResources(DSRequest)
    com.isomorphic.datasource.DSRequest.freeResources()
    com.isomorphic.datasource.DSRequest.execute()
    com.isomorphic.servlet.IDACall.handleDSRequest(DSRequest, RPCManager, RequestContext)
    com.isomorphic.servlet.IDACall.processRPCTransaction(RPCManager, RequestContext)
    com.isomorphic.servlet.IDACall.processRequest(HttpServletRequest, HttpServletResponse)
    com.isomorphic.servlet.IDACall.doPost(HttpServletRequest, HttpServletResponse)
    javax.servlet.http.HttpServlet.service(HttpServletRequest, HttpServletResponse)
    com.isomorphic.servlet.BaseServlet.service(HttpServletRequest, HttpServletResponse)
    javax.servlet.http.HttpServlet.service(ServletRequest, ServletResponse)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
    com.isomorphic.servlet.CompressionFilter.doFilter(ServletRequest, ServletResponse, FilterChain)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ServletRequest, ServletResponse)
    org.apache.catalina.core.StandardWrapperValve.invoke(Request, Response)
    org.apache.catalina.core.StandardContextValve.invoke(Request, Response)
    org.apache.catalina.core.StandardHostValve.invoke(Request, Response)
    org.apache.catalina.valves.ErrorReportValve.invoke(Request, Response)
    org.apache.catalina.core.StandardEngineValve.invoke(Request, Response)
    org.apache.catalina.connector.CoyoteAdapter.service(Request, Response)
    org.apache.coyote.http11.Http11AprProcessor.process(long)
    org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(long)
    org.apache.tomcat.util.net.AprEndpoint$Worker.run()
    java.lang.Thread.run()
    It has PhysicaConnection.close() call

    Not exactly sure what the behavior here is.

    2) The stack shows that the call for connection is from Apache dbcp. How do I make it to use Oracle connection pool instead

    3) I wanted to test if the connection pool size setting works on the apache connection pool

    I have the following properties:

    Code:
    getGlobal().put("sql.Oracle.interface.type","dataSource");
            getGlobal().put("sql.Oracle.driver","oracle.jdbc.pool.OracleDataSource");
        // getGlobal().put("sql.Oracle.pool.enabled", "true");
    
            getGlobal().put("sql.Oracle.driver.serverName", serverName);
            getGlobal().put("sql.Oracle.driver.portNumber", portNumber);
            getGlobal().put("sql.Oracle.driver.url", url);
            getGlobal().put("sql.Oracle.driver.user", userName);
            getGlobal().put("sql.Oracle.driver.password", passWord);
            getGlobal().put("sql.Oracle.pool.maxActive",0);
    The maxActive setting here has no effect, though I have set it to 0 only for testing purposes.

    4) The commented line:

    getGlobal().put("sql.Oracle.pool.enabled", "true");

    has no effect. I mean with/without the stack trace and the log statement are same as in 1).

    We are trying to validate the connection pooling etc. Let me know if there is standard approach to validate these.

    Thanks.

    #2
    This is a bunch of internal information which is not documented.

    Can you describe the problem you're having in terms of an actual behavioral issue?

    Comment


      #3
      Isomorphic,

      We have no issue as such. We want to limit number of connections in the pool. So we are experimenting with various settings.

      We are trying to configure the following:

      1) Use oracle pool instead of default apache dbcp
      2) limit number of connections that can be pooled.

      Please let me know how I can achieve the above two.

      The earlier post is based on the behavior observed when the server.properties are configured as in point 3) . The trace I have posted here is obtained from Java Profiling tool YourKit. The thread contains stack trace when a connection is initiated and connection is terminated.

      Let me know if I'm missing any info.

      Thanks.

      Comment


        #4
        To use the pool provided by your servlet engine, use JNDI-based SQL settings in server.properties (see AdminConsole docs for overview of all settings). Then use your servlet engine's configuration mechanism to control pooling.

        Comment


          #5
          Isomorphic,

          For whatever reason our company software standards don't encourage us to use JNDI, so jndi is not an option for us.

          Thanks.

          Comment


            #6
            There is no other means by which a servlet engine's connection pooling can be used, so it looks like you'll need to revisit your software standards if you want to use the servlet engine's pool.

            Comment


              #7
              Isomorphic,

              How about configuring the connection pool size of the default apache dbcp connection pool. As I mentioned in my first post maxActive to 0 has no effect at all both on the output or the stacktrace. So concerned if connection pooling is really happening with the settings mentioned in 3).

              Thanks.

              Comment


                #8
                We're not sure what you think is wrong with the stack trace or logs, let's not dive into undocumented internals here.

                If you are concerned about the connection pool, use a tool to monitor Oracle connections and if you think you've discovered a problem, let us know.

                Comment


                  #9
                  Sure, Can you suggest any specific tools here.

                  Thanks.

                  Comment

                  Working...
                  X