users@glassfish.java.net

Poor performance when executing SQL

From: <glassfish_at_javadesktop.org>
Date: Wed, 18 Jun 2008 11:25:38 PDT

I'm running inside of Glassfish v2ur2-b04-windows. I have two applications; one server application and one web client application. Both of these are web projects that are deployed to Glassfish as web applications. The Web client communicates to the server app via Web Services (CXF). The server application is built with an embedded Transaction Manager (Bitronix) and utilizes Spring for declarative transaction management. It is utilizing XA as we are communicating with multiple databases as well as a Messaging server. These applications run exceptionally well within Tomcat.

Now we are migrating to Glassfish and I want to utilize resources defined in JNDI, so I want to remove the existing embedded transaction manager and utilize Glassfish's implementation. I've swapped out the existing one in my Spring configuration files and now perform a look-up via JNDI. I acquire both the TransactionManager and UserTransaction via JNDI and I have defined my resource-env-ref's in my web.xml as well as my sun-web.xml files. I also have 3 XADataSources defined in both as well.

[b][u]My web.xml[/u][/b]
  <resource-env-ref>
    <resource-env-ref-name>TransactionManager</resource-env-ref-name>
    <resource-env-ref-type>javax.transaction.TransactionManager</resource-env-ref-type>
  </resource-env-ref>
  <resource-env-ref>
    <resource-env-ref-name>UserTransaction</resource-env-ref-name>
    <resource-env-ref-type>javax.transaction.UserTransaction</resource-env-ref-type>
  </resource-env-ref>
  <resource-ref>
    <res-ref-name>jdbc/dataSource1</res-ref-name>
    <res-type>javax.sql.XADataSource</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
  </resource-ref>
  <resource-ref>
    <res-ref-name>jdbc/dataSource2</res-ref-name>
    <res-type>javax.sql.XADataSource</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
  </resource-ref>
  <resource-ref>
    <res-ref-name>jdbc/dataSource3</res-ref-name>
    <res-type>javax.sql.XADataSource</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
  </resource-ref>

[b][u]My sun-web.xml[/u][/b]
  <resource-env-ref>
    <resource-env-ref-name>TransactionManager</resource-env-ref-name>
    <jndi-name>java:appserver/TransactionManager</jndi-name>
  </resource-env-ref>
  
  <resource-env-ref>
    <resource-env-ref-name>UserTransaction</resource-env-ref-name>
    <jndi-name>java:comp/UserTransaction</jndi-name>
  </resource-env-ref>
  <resource-ref>
    <res-ref-name>jdbc/dataSource1</res-ref-name>
    <jndi-name>java:comp/env/jdbc/cosmosDataSource</jndi-name>
  </resource-ref>
  <resource-ref>
    <res-ref-name>jdbc/dataSource2</res-ref-name>
    <jndi-name>java:comp/env/jdbc/partnerDataSource</jndi-name>
  </resource-ref>
  <resource-ref>
    <res-ref-name>jdbc/dataSource3</res-ref-name>
    <jndi-name>java:comp/env/jdbc/quotingDataSource</jndi-name>
  </resource-ref>


My Dao layer is a combination of both iBatis and Hibernate. The problem I am experiencing is that when I execute some of my exposed services the execution time is extremely slow. What previously only took 829(millis) for a method to execute and return is now taking 25(seconds) 24878(millis). Of course this is unacceptable, but the only changes I have made are the use of the Glassfish resources. I can still see my service being executed and I can see iBatis executing the SQL, but the time it takes to execute and return is a huge problem.

Do I have something mis-configured that would cause this degradation in performance?


[u][b]Log file trace:[/b][/u]
[#|2008-06-18T10:45:19.676-0700|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=35;_ThreadName=Dispatcher-Thread-69;|2008-06-18 10:45:19,676 [httpSSLWorkerThread-8080-1 : ] [INFO ,MethodTimingInterceptor] Method Invocation Begin [com.sybase.it.product.impl.ProductBrokerImpl.listDistinctCatalogs]

|#]

[#|2008-06-18T10:45:19.676-0700|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=35;_ThreadName=Dispatcher-Thread-69;|2008-06-18 10:45:19,676 [httpSSLWorkerThread-8080-1 : ] [INFO ,MethodTimingInterceptor] Method Invocation Begin [com.sybase.it.quoting.dao.ibatis.ProductDaoImpl.listCatalogs]

|#]

[#|2008-06-18T10:45:19.676-0700|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=35;_ThreadName=Dispatcher-Thread-69;|2008-06-18 10:45:19,676 [httpSSLWorkerThread-8080-1 : ] [DEBUG,ProductDaoImpl] Statement: Product.listCatalogs

|#]

[#|2008-06-18T10:45:19.676-0700|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=35;_ThreadName=Dispatcher-Thread-69;|2008-06-18 10:45:19,676 [httpSSLWorkerThread-8080-1 : ] [DEBUG,Connection] {conn-100006} Connection

|#]

[#|2008-06-18T10:45:19.676-0700|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=35;_ThreadName=Dispatcher-Thread-69;|2008-06-18 10:45:19,676 [httpSSLWorkerThread-8080-1 : ] [DEBUG,Connection] {conn-100006} Preparing Statement: SELECT ...

|#]

[#|2008-06-18T10:45:19.692-0700|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=35;_ThreadName=Dispatcher-Thread-69;|2008-06-18 10:45:19,692 [httpSSLWorkerThread-8080-1 : ] [DEBUG,PreparedStatement] {pstm-100007} Executing Statement: SELECT ...
|#]

[#|2008-06-18T10:45:19.692-0700|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=35;_ThreadName=Dispatcher-Thread-69;|2008-06-18 10:45:19,692 [httpSSLWorkerThread-8080-1 : ] [DEBUG,PreparedStatement] {pstm-100007} Parameters: [601, 601]

|#]

[#|2008-06-18T10:45:19.692-0700|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=35;_ThreadName=Dispatcher-Thread-69;|2008-06-18 10:45:19,692 [httpSSLWorkerThread-8080-1 : ] [DEBUG,PreparedStatement] {pstm-100007} Types: [java.lang.Integer, java.lang.Integer]

|#]

[#|2008-06-18T10:45:44.194-0700|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=35;_ThreadName=Dispatcher-Thread-69;|2008-06-18 10:45:44,194 [httpSSLWorkerThread-8080-1 : ] [INFO ,MethodTimingInterceptor] Method Invocation Complete [com.sybase.it.quoting.dao.ibatis.ProductDaoImpl.listCatalogs] Total Time: 25(seconds) 24518(millis)

|#]

[#|2008-06-18T10:45:44.554-0700|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=35;_ThreadName=Dispatcher-Thread-69;|2008-06-18 10:45:44,554 [httpSSLWorkerThread-8080-1 : ] [INFO ,MethodTimingInterceptor] Method Invocation Complete [com.sybase.it.product.impl.ProductBrokerImpl.listDistinctCatalogs] Total Time: 25(seconds) 24878(millis)
[Message sent by forum member 'cmathrusse' (cmathrusse)]

http://forums.java.net/jive/thread.jspa?messageID=281095