You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Erinc Arikan <er...@gmail.com> on 2009/06/04 19:24:56 UTC

JDBC Connection Pooling

Hi All;

I've been using IBATIS on our back end for some time. I am using simple
datasource and I haven't configured any database connection pool in the
configuration xml. I am wondering if there's a default connection pool
setting when that's the case(does ibatis by default take care of connection
pooling?) or does it mean that all the traffic is processed over one jdbc
connection?

If latter is the case, I feel like having a connection pool will increase
the performance significantly. Our system might process upto 1000 requests
per second, under forementioned assumptions what would be ideal connection
pool size?

Hoping to hear from you.

Thanks for the awesome product and help in advance.

Erinc

Re: JDBC Connection Pooling

Posted by kiran vuppla <ki...@yahoo.com>.
Below is the connection pooling using dbcp BasicDataSource. It all depends on the value you have given to "minIdle" propery when you started the application. As far I know it will never by default create pool size as 10.


    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driver}" />
        <property name="url" value="${jdbc.url}" />
        <property name="username" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />
        <property name="maxActive" value="${jdbc.maxActive}"/>
        <property name="maxIdle" value="${jdbc.maxIdle}"/>
        <property name="minIdle" value="${jdbc.minIdle}"/>
        <property name="maxWait" value="${jdbc.maxWait}"/>
        <property name="initialSize" value="${jdbc.initialSize}"/>
        <property name="logAbandoned" value="true"/>
        <property name="testWhileIdle" value="true"/>
        <property name="defaultAutoCommit" value="false"/>
        <property name="poolPreparedStatements" value="true"/>
        <property name="numTestsPerEvictionRun" value="5"/>
        <property name="timeBetweenEvictionRunsMillis" value="5000"/>
        <property name="validationQuery" value="select * from dual"/>
    </bean> 

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    <property name="configLocation" value="config.xml"/>
    <property name="dataSource" ref="dataSource"/>
  </bean>

-Kiran



________________________________
From: Vinaya Tirikkovalluru <vi...@converge.com>
To: user-java@ibatis.apache.org
Sent: Thursday, June 4, 2009 3:13:18 PM
Subject: RE: JDBC Connection Pooling


Hi Erinc,
 
Even though the documentation says, iBatis
sets up the connection pool with min pool size as 10, I was not able to see the
10 connection in the database. So I am skeptical about this.
 
But when I setup the connection pool with
Jboss, I was able to see the min size(5) connections as soon as I started the
application.
 
Vinaya
 

________________________________
 
From:Erinc Arikan
[mailto:erincarikan@gmail.com] 
Sent: Thursday, June 04, 2009 3:05
PM
To: user-java@ibatis.apache.org
Subject: Re: JDBC Connection
Pooling
 
Thanks a lot Vinaya;
 
I already read your question and the answer.
 
To find out an answer for my question, I went through tutorial and
It looks like if you don't specify pool properties default values are
used.(MaxActiveConns = 10 and MaxIdleConnections = 5), so that's the default
behavior.
 
Even though we have enough information about database pooling settings
in the tutorial, I couldn't find any information about maxRequests,
maxSessions, maxTransactions attributes of the setting element. 
 
For instance I set my MaxActiveConnections to 500 and
MaxIdleConnections to 5, since I don't want idle connections on my connection
pool. How should I set my maxRequests, maxSessions and maxTransactions?(Default
values are 512,128,32) Is default value for each setting is good?
 
Is simple datasource pooling good for an application that can
handle 1000 requests per second, or should I consider using DBCP for
pooling?
 
Thanks in advance.
 
Erinc
On Thu, Jun 4, 2009 at 1:35 PM, Vinaya Tirikkovalluru <vi...@converge.com>
wrote:
Hi,
 
I am not sure about iBatis taking care of connection pooling.
But I had a situation similar to you I have noticed that the creation of the
connection and closing the connection is taken care by iBatis. I have seen that
in the production environment, where we have almost 100 concurrent user, there
were only 4 connections. We did not have any issues with the connections till
now. 
 
I am trying to establish a connection pooling now.
But see the attached reply to my question.
 
Vinaya
 

________________________________
 
From:Erinc Arikan [mailto:erincarikan@gmail.com] 
Sent: Thursday, June 04, 2009 1:25
PM
To: user-java@ibatis.apache.org
Subject: JDBC Connection Pooling
 
Hi All;
 
I've been
using IBATIS on our back end for some time. I am using simple datasource and I
haven't configured any database connection pool in the configuration xml. I am
wondering if there's a default connection pool setting when that's the
case(does ibatis by default take care of connection pooling?) or does it mean
that all the traffic is processed over one jdbc connection? 
 
If latter is the case, I feel like having a connection pool will increase the
performance significantly. Our system might process upto 1000 requests per
second, under forementioned assumptions what would be ideal connection pool
size?
 
Hoping to hear from you.
 
Thanks for the awesome product and help in advance.
 
Erinc

________________________________
 
This electronic message is intended only for the use of the
individual(s) or entity(ies) named above and may contain information which is
privileged and/or confidential. If you are not the intended recipient, be aware
that any disclosure, copying, distribution, dissemination or use of the
contents of this message is prohibited. If you received this message in error,
please notify the sender immediately. 


---------- Forwarded message ----------
From: "Clinton Begin" <cl...@gmail.com>
To: <us...@ibatis.apache.org>
Date: Thu, 4 Jun 2009 00:34:18 -0400
Subject: Re: Connection Pooling
If you have a fast, well designed database with well written SQL, it's quite
possible that you'd never need more than a few connections for many users.

The default pool size for TopLink when I used it was 6 (4 read, 2 write or
something like that).  It's a common misconception that more connections
== better performance. 

Clinton
On Wed, Jun 3, 2009 at 12:35 PM, Vinaya Tirikkovalluru <vi...@converge.com>
wrote:
Hi,
 
I
am using Ibatis+Jboss4.2.2
 
I
have not configured connection pooling in Jboss. 
Ibatis
takes care of everything. But I see a connection in the database which is open
in the morning but still being used, like reused. I just see a couple of them
and not too many.
How
could just the 2/3 connections serve all the concurrent users? Would it be a
good idea to have connection pooling set up?
Please
advice
 
Vinaya
 
 

________________________________
 
This electronic message is intended only for the use of the
individual(s) or entity(ies) named above and may contain information which is
privileged and/or confidential. If you are not the intended recipient, be aware
that any disclosure, copying, distribution, dissemination or use of the
contents of this message is prohibited. If you received this message in error,
please notify the sender immediately. 
 
 

________________________________
 This electronic message is intended only for the use of the individual(s) or entity(ies) named above and may contain information which is privileged and/or confidential.  If you are not the intended recipient, be aware that any disclosure, copying, distribution, dissemination or use of the contents of this message is prohibited.  If you received this message in error, please notify the sender immediately. 


      

RE: JDBC Connection Pooling

Posted by Vinaya Tirikkovalluru <vi...@converge.com>.
Hi Erinc,

 

Even though the documentation says, iBatis sets up the connection pool
with min pool size as 10, I was not able to see the 10 connection in the
database. So I am skeptical about this.

 

But when I setup the connection pool with Jboss, I was able to see the
min size(5) connections as soon as I started the application.

 

Vinaya

 

________________________________

From: Erinc Arikan [mailto:erincarikan@gmail.com] 
Sent: Thursday, June 04, 2009 3:05 PM
To: user-java@ibatis.apache.org
Subject: Re: JDBC Connection Pooling

 

Thanks a lot Vinaya;

 

I already read your question and the answer.

 

To find out an answer for my question, I went through tutorial and It
looks like if you don't specify pool properties default values are
used.(MaxActiveConns = 10 and MaxIdleConnections = 5), so that's the
default behavior.

 

Even though we have enough information about database pooling settings
in the tutorial, I couldn't find any information about maxRequests,
maxSessions, maxTransactions attributes of the setting element. 

 

For instance I set my MaxActiveConnections to 500 and MaxIdleConnections
to 5, since I don't want idle connections on my connection pool. How
should I set my maxRequests, maxSessions and maxTransactions?(Default
values are 512,128,32) Is default value for each setting is good?

 

Is simple datasource pooling good for an application that can handle
1000 requests per second, or should I consider using DBCP for pooling?

 

Thanks in advance.

 

Erinc

On Thu, Jun 4, 2009 at 1:35 PM, Vinaya Tirikkovalluru
<vi...@converge.com> wrote:

Hi,

 

I am not sure about iBatis taking care of connection pooling. But I had
a situation similar to you I have noticed that the creation of the
connection and closing the connection is taken care by iBatis. I have
seen that in the production environment, where we have almost 100
concurrent user, there were only 4 connections. We did not have any
issues with the connections till now. 

 

I am trying to establish a connection pooling now.

But see the attached reply to my question.

 

Vinaya

 

________________________________

From: Erinc Arikan [mailto:erincarikan@gmail.com] 
Sent: Thursday, June 04, 2009 1:25 PM
To: user-java@ibatis.apache.org
Subject: JDBC Connection Pooling

 

Hi All;

 

I've been using IBATIS on our back end for some time. I am using simple
datasource and I haven't configured any database connection pool in the
configuration xml. I am wondering if there's a default connection pool
setting when that's the case(does ibatis by default take care of
connection pooling?) or does it mean that all the traffic is processed
over one jdbc connection? 
 
If latter is the case, I feel like having a connection pool will
increase the performance significantly. Our system might process upto
1000 requests per second, under forementioned assumptions what would be
ideal connection pool size?
 
Hoping to hear from you.
 
Thanks for the awesome product and help in advance.
 

Erinc

________________________________

This electronic message is intended only for the use of the
individual(s) or entity(ies) named above and may contain information
which is privileged and/or confidential. If you are not the intended
recipient, be aware that any disclosure, copying, distribution,
dissemination or use of the contents of this message is prohibited. If
you received this message in error, please notify the sender
immediately. 



---------- Forwarded message ----------
From: "Clinton Begin" <cl...@gmail.com>
To: <us...@ibatis.apache.org>
Date: Thu, 4 Jun 2009 00:34:18 -0400
Subject: Re: Connection Pooling
If you have a fast, well designed database with well written SQL, it's
quite possible that you'd never need more than a few connections for
many users.

The default pool size for TopLink when I used it was 6 (4 read, 2 write
or something like that).  It's a common misconception that more
connections == better performance. 

Clinton

On Wed, Jun 3, 2009 at 12:35 PM, Vinaya Tirikkovalluru
<vi...@converge.com> wrote:

Hi,

 

I am using Ibatis+Jboss4.2.2

 

I have not configured connection pooling in Jboss. 

Ibatis takes care of everything. But I see a connection in the database
which is open in the morning but still being used, like reused. I just
see a couple of them and not too many.

How could just the 2/3 connections serve all the concurrent users? Would
it be a good idea to have connection pooling set up?

Please advice

 

Vinaya

 

 

________________________________

This electronic message is intended only for the use of the
individual(s) or entity(ies) named above and may contain information
which is privileged and/or confidential. If you are not the intended
recipient, be aware that any disclosure, copying, distribution,
dissemination or use of the contents of this message is prohibited. If
you received this message in error, please notify the sender
immediately. 

 

 



This electronic message is intended only for the use of the individual(s) or entity(ies) named above and may contain information which is privileged and/or confidential.  If you are not the intended recipient, be aware that any disclosure, copying, distribution, dissemination or use of the contents of this message is prohibited.  If you received this message in error, please notify the sender immediately.

Re: JDBC Connection Pooling

Posted by Erinc Arikan <er...@gmail.com>.
Thanks a lot Vinaya;

I already read your question and the answer.

To find out an answer for my question, I went through tutorial and It looks
like if you don't specify pool properties default values are
used.(MaxActiveConns = 10 and MaxIdleConnections = 5), so that's the default
behavior.

Even though we have enough information about database pooling settings in
the tutorial, I couldn't find any information about maxRequests,
maxSessions, maxTransactions attributes of the setting element.

For instance I set my MaxActiveConnections to 500 and MaxIdleConnections to
5, since I don't want idle connections on my connection pool. How should I
set my maxRequests, maxSessions and maxTransactions?(Default values are
512,128,32) Is default value for each setting is good?

Is simple datasource pooling good for an application that can handle 1000
requests per second, or should I consider using DBCP for pooling?

Thanks in advance.

Erinc

On Thu, Jun 4, 2009 at 1:35 PM, Vinaya Tirikkovalluru <
vinaya.tirikkovalluru@converge.com> wrote:

>  Hi,
>
>
>
> I am not sure about iBatis taking care of connection pooling. But I had a
> situation similar to you I have noticed that the creation of the connection
> and closing the connection is taken care by iBatis. I have seen that in the
> production environment, where we have almost 100 concurrent user, there were
> only 4 connections. We did not have any issues with the connections till
> now.
>
>
>
> I am trying to establish a connection pooling now.
>
> But see the attached reply to my question.
>
>
>
> Vinaya
>
>
>  ------------------------------
>
> *From:* Erinc Arikan [mailto:erincarikan@gmail.com]
> *Sent:* Thursday, June 04, 2009 1:25 PM
> *To:* user-java@ibatis.apache.org
> *Subject:* JDBC Connection Pooling
>
>
>
> Hi All;
>
>
>
> I've been using IBATIS on our back end for some time. I am using simple
> datasource and I haven't configured any database connection pool in the
> configuration xml. I am wondering if there's a default connection pool
> setting when that's the case(does ibatis by default take care of connection
> pooling?) or does it mean that all the traffic is processed over one jdbc
> connection?
>
> If latter is the case, I feel like having a connection pool will increase
> the performance significantly. Our system might process upto 1000 requests
> per second, under forementioned assumptions what would be ideal connection
> pool size?
>
> Hoping to hear from you.
>
> Thanks for the awesome product and help in advance.
>
>
> Erinc
>
> ------------------------------
> This electronic message is intended only for the use of the individual(s)
> or entity(ies) named above and may contain information which is privileged
> and/or confidential. If you are not the intended recipient, be aware that
> any disclosure, copying, distribution, dissemination or use of the contents
> of this message is prohibited. If you received this message in error, please
> notify the sender immediately.
>
>
>
> ---------- Forwarded message ----------
> From: "Clinton Begin" <cl...@gmail.com>
> To: <us...@ibatis.apache.org>
> Date: Thu, 4 Jun 2009 00:34:18 -0400
> Subject: Re: Connection Pooling
> If you have a fast, well designed database with well written SQL, it's
> quite possible that you'd never need more than a few connections for many
> users.
>
> The default pool size for TopLink when I used it was 6 (4 read, 2 write or
> something like that).  It's a common misconception that more connections ==
> better performance.
>
> Clinton
>
> On Wed, Jun 3, 2009 at 12:35 PM, Vinaya Tirikkovalluru <
> vinaya.tirikkovalluru@converge.com> wrote:
>
>>  Hi,
>>
>>
>>
>> I am using Ibatis+Jboss4.2.2
>>
>>
>>
>> I have not configured connection pooling in Jboss.
>>
>> Ibatis takes care of everything. But I see a connection in the database
>> which is open in the morning but still being used, like reused. I just see a
>> couple of them and not too many.
>>
>> How could just the 2/3 connections serve all the concurrent users? Would
>> it be a good idea to have connection pooling set up?
>>
>> Please advice
>>
>>
>>
>> Vinaya
>>
>>
>>
>>
>>
>> ------------------------------
>> This electronic message is intended only for the use of the individual(s)
>> or entity(ies) named above and may contain information which is privileged
>> and/or confidential. If you are not the intended recipient, be aware that
>> any disclosure, copying, distribution, dissemination or use of the contents
>> of this message is prohibited. If you received this message in error, please
>> notify the sender immediately.
>>
>
>
>

RE: JDBC Connection Pooling

Posted by Vinaya Tirikkovalluru <vi...@converge.com>.
Hi,

 

I am not sure about iBatis taking care of connection pooling. But I had
a situation similar to you I have noticed that the creation of the
connection and closing the connection is taken care by iBatis. I have
seen that in the production environment, where we have almost 100
concurrent user, there were only 4 connections. We did not have any
issues with the connections till now. 

 

I am trying to establish a connection pooling now.

But see the attached reply to my question.

 

Vinaya

 

________________________________

From: Erinc Arikan [mailto:erincarikan@gmail.com] 
Sent: Thursday, June 04, 2009 1:25 PM
To: user-java@ibatis.apache.org
Subject: JDBC Connection Pooling

 

Hi All;

 

I've been using IBATIS on our back end for some time. I am using simple
datasource and I haven't configured any database connection pool in the
configuration xml. I am wondering if there's a default connection pool
setting when that's the case(does ibatis by default take care of
connection pooling?) or does it mean that all the traffic is processed
over one jdbc connection? 
 
If latter is the case, I feel like having a connection pool will
increase the performance significantly. Our system might process upto
1000 requests per second, under forementioned assumptions what would be
ideal connection pool size?
 
Hoping to hear from you.
 
Thanks for the awesome product and help in advance.
 

Erinc



This electronic message is intended only for the use of the individual(s) or entity(ies) named above and may contain information which is privileged and/or confidential.  If you are not the intended recipient, be aware that any disclosure, copying, distribution, dissemination or use of the contents of this message is prohibited.  If you received this message in error, please notify the sender immediately.