You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by "Johnson, Russ A" <rj...@sprintspectrum.com> on 2002/05/20 17:24:23 UTC

Multi-threading and connection pooling

I have a design question.

I have a multi-threaded servlet and that executes a number of sql
statements.  I am re-using the same connection object for each of the sql
statements.  Should I have a separate connection object for each sql
statement?  I am using a connection pooling object.

Thanks


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Multi-threading and connection pooling

Posted by Berin Loritsch <bl...@apache.org>.
> From: Mike Stover [mailto:mstover1@apache.org] 
> 
> This is off-topic to this list.  A quick answer is that it 
> depends on your database how many 
> times you can "re-use" a connection object.  In JMeter's JDBC 
> testing, you can specify how 
> many times the connection pool allows each connection to be 
> reused.  Thus, you can test the 
> difference in performance between reusing a connection only 
> once, or reusing it 1000 times 
> before re-initializing it.  Just as an example, with MySQL, I 
> have found that re-using 
> connections more than 50 times starts to degrade performance 
> slightly.  Recreating 
> connections to MySQL is so fast, that it's better to 
> re-initialize your connections frequently 
> rather than use old ones.  I'm sure other databases are quite 
> different.

Quite interesting.  Contrast that with Oracle's JDBC driver which
can take a whole second or two to do its handshaking with the
server.  Obviously, reusing connections there will help a whole lot.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Multi-threading and connection pooling

Posted by Mike Stover <ms...@apache.org>.
This is off-topic to this list.  A quick answer is that it depends on your database how many 
times you can "re-use" a connection object.  In JMeter's JDBC testing, you can specify how 
many times the connection pool allows each connection to be reused.  Thus, you can test the 
difference in performance between reusing a connection only once, or reusing it 1000 times 
before re-initializing it.  Just as an example, with MySQL, I have found that re-using 
connections more than 50 times starts to degrade performance slightly.  Recreating 
connections to MySQL is so fast, that it's better to re-initialize your connections frequently 
rather than use old ones.  I'm sure other databases are quite different.

-Mike

On 20 May 2002 at 10:24, Johnson, Russ A wrote:

> I have a design question.
> 
> I have a multi-threaded servlet and that executes a number of sql
> statements.  I am re-using the same connection object for each of the sql
> statements.  Should I have a separate connection object for each sql
> statement?  I am using a connection pooling object.
> 
> Thanks
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 



--
Michael Stover
mstover1@apache.org
Yahoo IM: mstover_ya
ICQ: 152975688

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>