aspose file tools*
The moose likes Performance and the fly likes Connection problem on Stress Testing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Connection problem on Stress Testing" Watch "Connection problem on Stress Testing" New topic
Author

Connection problem on Stress Testing

Andres Delrotti
Ranch Hand

Joined: Aug 11, 2005
Posts: 137
Hello friends,

I have this problem at getting connections when I stress test some of the Use Cases of my application. I used the OpenSTA testing tool for testing 100 users concurrently doing an application use case. Now, this is the problem that happens, when I do this test for 100 users, it really takes a very very long time for the datasource object to return a connection. I don't have an idea why.

After waiting for it to return a connection, this exception happens instead:

com.ibm.db2.jcc.b.SQLException
at com.ibm.db2.jcc.b.l.a(l.java(Compiled Code))
at com.ibm.db2.jcc.a.bb.h(bb.java:541)
at com.ibm.db2.jcc.a.bb.g(bb.java:443)
at com.ibm.db2.jcc.a.bb.d(bb.java:276)
at com.ibm.db2.jcc.DB2PooledConnection.connect (DB2PooledConnection.java:107)
.....
....


Here's part of the code:

private static final Datasource myDataSource

Connection cnx = null;
InitialContext ctx = new InitialContext();
if (myDataSource==null){
myDataSource = (DataSource) ctx.lookup("jdbc/mydatasource");
}
cnx = myDataSource.getConnection(); <-- this is the part where it takes so long and also where the exception happens


They told me that my application may have a connection leak but I already double checked the source codes and there seems to be no problem. I've already got a connection.close() in the finally block of every method in my Data Access Objects (DAO).

Could it be that the problem is in the database? or maybe the datasource settings in the Websphere Application Server where my application in deployed?

I'd appreciate any form of help. Thanks
[ September 05, 2006: Message edited by: Andres Delrotti ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10048
    
163

The connections in a Datasource are pooled. Whenever a request is made for a connection, the connection is returned from this pool. While configuring the datasource, the maximum pool size and the minimum pool size can be specified. In your case if 100 users are simultaneously asking for a connection then the pool size should be sufficient enough to return these connections. What are the values that you have specified for the maximum and minimum pool size on the datasource?


[My Blog] [JavaRanch Journal]
Andres Delrotti
Ranch Hand

Joined: Aug 11, 2005
Posts: 137
I used the default values:

min = 1
max = 10
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10048
    
163

If you are trying to obtain 100 connections simultaneously during the stress testing then you will have to increase these values appropriately.
 
 
subject: Connection problem on Stress Testing