Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection problem on Stress Testing

 
Andres Delrotti
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Andres Delrotti
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used the default values:

min = 1
max = 10
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are trying to obtain 100 connections simultaneously during the stress testing then you will have to increase these values appropriately.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic