3 Replies Latest reply on Dec 27, 2005 7:38 PM by jboss05

    Need help with JBoss connection pooling and performance!

    jboss05

      Hi All,

      We currently have a legacy application server which does not do any connection pooling. We've recently ported this application to JBoss. When we ran the performance tests against both these servers, we found that our JBoss version of the server is taking more time compared to the legacy one. We've spent quite some time reading various wiki pages, posts etc but still unable to resolve the issue.

      Here's the actual problem.

      On our server ported to JBoss (running on 4.0.1sp1 on JDK 1.4.2 on Mac OS X 10.4.3), we found that as the JBoss does connection pooling, the time taken by JBoss to get the connection from the pool and change the switch the db username and password seems to be significant.

      For example, we ran the same queries against our legacy server and new server returning the same set of results. In this case, for the first time, as our legacy server needs to establish connection with the DB, it takes more time than our JBoss based server. But for the subsequent queries (SAME QUERIES), our legacy server's response time is better. Our legacy server takes 6978ms and the JBoss based server is taking 7976ms. The difference is huge.

      In our JBoss based server, we are using JBoss for connection pooling but we are not USING EJB or anything else. We are using JDBC APIS directly once we get the connection including creating prepared statement, executing the query and getting the results from the database.

      We've spent almost 2-3 weeks on this trying out various things including Yourkit profiler. But we are unable to tune our JBoss based server to match the performance of our legacy server. It is very important for us to be able to match the performance of our legacy server otherwise we will NOT be able to JUSTIFY the use of JBoss in our organization. This is the first application on JBoss.


      Could someone please throw some light on what could possibly be the reason why there is a significant difference in performance and how can we improve this?

      Thanks in advance for your input!

        • 1. Re: Need help with JBoss connection pooling and performance!
          jboss05

          Could someone please respond to me?

          Thanks for your help!

          • 2. Re: Need help with JBoss connection pooling and performance!
            genman


            Could be prepared statement caching is not working out for you. Perhaps you're not closing them?

            What did your profiler saying? It could be your use of the JDBC on the legacy server wasn't correct. Likely an unclosed result set or something.

            The pooling is a little bit of overhead, but not significant (more than 1-2ms I'd say)

            • 3. Re: Need help with JBoss connection pooling and performance!
              jboss05

              Thanks genman. We found the issue. The fetch size was not the same in the legacy and JBoss version of the code. It was 20 in our legacy server and is default value 10 in the JBoss version. After changing this, we saw a significant change in performance. But there is still a 40-50ms difference between the new and old server.

              This 40-50ms extra time is taken by the rollback opearation. In our JBoss based server, while we return the connection back to the pool, we do the rollback to make sure that those transactions that are not commited by the application is rolled back. I am not sure if we should do this or it is already being done by the JBoss connection pool. Could some one please let me know if we should do the rollback before returning the connection to the pool (of course, we do call the connection.close method after this)?