tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Mikusa <dmik...@gopivotal.com>
Subject Re: Reg: Connection pool
Date Tue, 01 Oct 2013 11:16:56 GMT
On Oct 1, 2013, at 5:10 AM, Anu Prab <anuprab2@gmail.com> wrote:

> On Sep 27, 2013, at 12:21 AM, Anu Prab <anuprab2@gmail.com> wrote:
> 
> 
> 
> 
> 
> 
> 
>> On Sep 26, 2013, at 6:02 PM, Christopher Schultz <
> 
> 
> 
>> chris@christopherschultz.net> wrote:
> 
> 
> 
>> 
> 
> 
> 
>>> -----BEGIN PGP SIGNED MESSAGE-----
> 
> 
> 
>> 
> 
> 
> 
>>> Hash: SHA256
> 
> 
> 
>> 
> 
> 
> 
>>> 
> 
> 
> 
>> 
> 
> 
> 
>>> Daniel,
> 
> 
> 
>> 
> 
> 
> 
>>> 
> 
> 
> 
>> 
> 
> 
> 
>>> On 9/26/13 9:18 AM, Daniel Mikusa wrote:
> 
> 
> 
>> 
> 
> 
> 
>>>> On Sep 26, 2013, at 2:22 AM, Anu Prab <anuprab2@gmail.com> wrote:
> 
> 
> 
>> 
> 
> 
> 
>>>> 
> 
> 
> 
>> 
> 
> 
> 
>>>>> I am using Tomcat version 7.
> 
> 
> 
>> 
> 
> 
> 
>>>> 
> 
> 
> 
>> 
> 
> 
> 
>>>> For future reference, please include the exact version of Tomcat you
> 
> 
> 
>> 
> 
> 
> 
>>>> are running.  There are 40+ different versions.
> 
> 
> 
>> 
> 
> 
> 
>>>> 
> 
> 
> 
>> 
> 
> 
> 
>>>>> Is it possible to update connection pool properties without
> 
> 
> 
>> 
> 
> 
> 
>>>>> restarting the Tomcat server?
> 
> 
> 
>> 
> 
> 
> 
>>>> 
> 
> 
> 
>> 
> 
> 
> 
>>>> Please also include specific details like which connection pool are
> 
> 
> 
>> 
> 
> 
> 
>>>> you using.  There are two included with Tomcat, DBCP and tomcat-jdbc.
> 
> 
> 
>> 
> 
> 
> 
>>>> 
> 
> 
> 
>> 
> 
> 
> 
>>>> To give a general answer to your question, you can update some of
> 
> 
> 
>>>> the
> 
> 
> 
>> 
> 
> 
> 
>>>> properties through JMX.  It'll depend on the version of Tomcat and
> 
> 
> 
>> 
> 
> 
> 
>>>> which pool you are using as to which properties you can update.
> 
> 
> 
>> 
> 
> 
> 
>>>> Try connecting with jconsole or jvisualvm w/MBeans plugin and see if
> 
> 
> 
>> 
> 
> 
> 
>>>> the properties you need are exposed and editable.
> 
> 
> 
>> 
> 
> 
> 
>>> 
> 
> 
> 
>> 
> 
> 
> 
>>> While most properties are not immutable (e.g. you can change their
> 
> 
> 
>> 
> 
> 
> 
>>> values via JMX), changing them usually has no effect because the
> 
> 
> 
>> 
> 
> 
> 
>>> connection pool is not re-initialized when those values change.
> 
> 
> 
>> 
> 
> 
> 
>> 
> 
> 
> 
>> 
> 
> 
> 
>> Good point.  It's important to be realistic about what you can do at
> 
> 
> 
>> runtime.
> 
> 
> 
>> 
> 
> 
> 
>> 
> 
> 
> 
>> 
> 
> 
> 
>>> Perhaps Anu can give us a use case for when this kind of thing would
> 
> 
> 
>> 
> 
> 
> 
>>> be appropriate... what would you want to change during runtime in a
> 
> 
> 
>> 
> 
> 
> 
>>> stable system?
> 
> 
> 
>> 
> 
> 
> 
>> 
> 
> 
> 
>> 
> 
> 
> 
>> +1 definitely need more info here.
> 
> 
> 
>> 
> 
> 
> 
>> Dan
> 
> 
> 
>> 
> 
> 
> 
>> 
> 
> 
> 
>> 
> 
> 
> 
>> Hi,
> 
> 
> 
>> 
> 
> 
> 
>> Sorry, please ignore my previous mail. My bad.
> 
> 
> 
>> 
> 
> 
> 
>> The Tomcat version I am using is 7.0.40 and the connection pool is
> 
> 
> 
>> tomcat-jdbc.
> 
> 
> 
>> 
> 
> 
> 
>> Well, one case would be to increase the maxActive property so that if
> 
> 
> 
>> I want to increase this threshold limit, how do I do it?.
> 
> 
> 
> 
> 
> 
> 
> Connect with jconsole or jvisualvm.  Navigate to tomcat.jdbc ->
> ConnectionPool -> "<your jndi name>" ->
> org.apache.tomcat.jdbc.pool.DataSource.  Edit the "maxActive" attribute.
> 
> 
> 
> 
> 
> 
> 
> For the most part this works OK.  There were a couple quirks that I noticed
> in my quick test.
> 
> 
> 
> 
> 
> 
> 
>  - When decreasing maxActive, if you set it lower than the number of
> connections already it has no effect until the number of connects drops
> below maxActive.
> 
> 
> 
> 
> 
> 
> 
>   -   If I tried to grab a connection from the pool and the pool has
> 
> already hit maxActive, my request would fail.  However subsequent requests
> would succeed.
> 
> 
> 
> 
> 
> 
> 
> There could be others, so I'd suggest you test your specific use case in a
> controlled environment before trying it in production.
> 
> 
> 
> 
> 
> 
> 
> Having said all this, I would agree that it's better to properly size your
> connection pool from the start.  If that's not possible, this should work
> for you though.
> 
> 
> 
> 
> 
> 
> 
> Dan
> 
> 
> 
> 
> 
> 
> 
>> Thank you Dan for your inputs.
> 
> 
> 
> One more information please:
> 
> I have a datasource created through a Servlet and no configuration
> information is provided in the context.xml. If some other class within the
> same web app wants to do a lookup for this datasource, how to go about
> doing this?

Make it easy on yourself and don't do that.  Setup your DataSource in JNDI.  Look it up when
you need it.

Dan

> 
> - Anu


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message