You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John Gorkos <jo...@sensus.com> on 2006/11/01 18:49:57 UTC

DBCP Pool not context-specific?

I have a DBCP quandry that I'm puzzled by.  I use per-context JNDI handles to 
the same Postgres database for multiple apps running inside tomcat.  Each 
context.xml sets up connection limits, max idle, etc, slightly differently.

One of my apps was not closing DBhandle correctly (I might take issue with the 
instructions posted at 
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html , 
but that's for another email) and was exhausting the pool.  The part that 
puzzles me is that the other applications were ALSO affected by the pool 
exhaustion.  Does tomcat not set up per-context pools, but rather share one 
pool among all contexts, even though I specified pools per context?   If it 
only uses one pool, which set of configuration params does it choose (since I 
set different params in each context.xml).

Thanks!

John Gorkos

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


Re: DBCP Pool not context-specific?

Posted by John Gorkos <jo...@sensus.com>.
On Wednesday 01 November 2006 13:39, Pid wrote:
> if, (for whatever reason), one webapp isn't releasing connections, but
> is able to keep creating them, then eventually you'll run out of
> available connections at the DB end, no?
Yes, but the database was set up to allow 500 connections, and the pool was 
running dry after 50.  The disturbing part is that the pool was running dry 
in one context and causing other contexts in the same VM to throw 
PoolExhausted exceptions.  I was hoping for a higher degree of seperation 
between contexts than what I got.
>
> i'd expend effort determining why the app isn't releasing the
> connections, as that's the real problem.
>
Done.  We followed the JNDI datasource reccomendations on the Tomcat web page 
and got bit.  It was my fault for cutting and pasting so verbatim.  The app 
works and releases correctly now.

John Gorkos


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


Re: DBCP Pool not context-specific?

Posted by Pid <p...@pidster.com>.
if, (for whatever reason), one webapp isn't releasing connections, but
is able to keep creating them, then eventually you'll run out of
available connections at the DB end, no?

i'd expend effort determining why the app isn't releasing the
connections, as that's the real problem.



John Gorkos wrote:
> On Wednesday 01 November 2006 12:19, Christopher Schultz wrote:
> <snip>
>>> using a per-app context XML that looks like this:
>>>
>>> <Context crossContext="true" debug="10" docBase="AMDSTools"
>> It looks like you have your resource defined (correctly) in context.xml,
>> which is what I would expect do to for context isolation of such a
>> DataSource.
>>
>> I wonder if "crossContext=true" muddles this at all? My understanding is
>> that crossContext="true" basically changes the cookie path from "/myapp"
>> to "/", and allows a globally-managed session instead of per-context
>> sessions. I'm grasping at straws, here, since your config at least looks
>> plausible.
>>
>>>     <Resource name="jdbc/psql" auth="Container"
>> Any chance that your JNDI names are colliding with other apps? I dunno
>> if Tomcat provides JNDI isolation for contexts (although it wouldn't
>> make any sense not to provide that).
> Indeed, they ALL use this same resource name...  
> 
> 
>> If none of these turns out to be the problem, you may have to re-post
>> your question. Often, folks on the list assume that a continued
>> conversation means that the problem is getting solved by someone else,
>> and might not read it. If you don't get a reply for a day or so, re-post
>> with some of the extra information you've provided to me.
>>
>> I'm not an expert when it comes to the subtleties of Tomcat and context
>> isolation. Who knows... maybe you even found a bug.
>>
>> -chris
> thanks for your help.  I think I'll try changing resource names.  A name that 
> includes the appName would help prevent collisions, especially on a shared 
> server, where I don't own all the apps.
> 
> John Gorkos
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 


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


Re: DBCP Pool not context-specific?

Posted by John Gorkos <jo...@sensus.com>.
On Wednesday 01 November 2006 12:19, Christopher Schultz wrote:
<snip>
> > using a per-app context XML that looks like this:
> >
> > <Context crossContext="true" debug="10" docBase="AMDSTools"
>
> It looks like you have your resource defined (correctly) in context.xml,
> which is what I would expect do to for context isolation of such a
> DataSource.
>
> I wonder if "crossContext=true" muddles this at all? My understanding is
> that crossContext="true" basically changes the cookie path from "/myapp"
> to "/", and allows a globally-managed session instead of per-context
> sessions. I'm grasping at straws, here, since your config at least looks
> plausible.
>
> >     <Resource name="jdbc/psql" auth="Container"
>
> Any chance that your JNDI names are colliding with other apps? I dunno
> if Tomcat provides JNDI isolation for contexts (although it wouldn't
> make any sense not to provide that).
Indeed, they ALL use this same resource name...  


>
> If none of these turns out to be the problem, you may have to re-post
> your question. Often, folks on the list assume that a continued
> conversation means that the problem is getting solved by someone else,
> and might not read it. If you don't get a reply for a day or so, re-post
> with some of the extra information you've provided to me.
>
> I'm not an expert when it comes to the subtleties of Tomcat and context
> isolation. Who knows... maybe you even found a bug.
>
> -chris
thanks for your help.  I think I'll try changing resource names.  A name that 
includes the appName would help prevent collisions, especially on a shared 
server, where I don't own all the apps.

John Gorkos

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


Re: How stable is tomcat

Posted by David Kerber <dc...@verizon.net>.
Dima Retov wrote:

>Thanks Dave.
>
>What version of JVM have you used?
>  
>
I believe (not sure) it's 1.5.0_06 on the server; I'm running _07 on my 
dev machine.  As Rainer mentioned, don't try to use hot deployment for 
busy apps; I always stop tomcat for updates, so my updates tend to be 
saved up and posted every few months.  As Rainer also mentioned, check 
your memory usage for the first few weeks to be sure you don't have any 
leaks.  I had a couple when that busy app first went into beta testing a 
couple of years ago, and it wouldn't go more than a week or so without 
running into out of memory errors..

Dave



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


Re: How stable is tomcat

Posted by Rainer Jung <ra...@kippdata.de>.
Concerning my experience: no stability issues with either 1.4.2 or 1.5,
as long as you stick to a reasonably new patch level (not the one, which
might be only a week old, but the newest one older than a month should
be perfect).

Dima Retov schrieb:
> Thanks Dave.
> 
> What version of JVM have you used?
> 
> Wednesday, November 1, 2006, 8:57:19 PM, you wrote:
> 
> DK> Dima Retov wrote:
> 
>>> How stable is tomcat with Sun's HotSpot JVM 1.5?
>>>
>>> Right now we have apache servers that are up for 3 and 4 months.
>>> So I guess apache 1.3 may works for months.
>>>
>>> How stable is tomcat against apache or other webservers?
>>>
>>> Would tomcat be able to work 1 year without restart?
>>>  
>>>
> DK> I've had three instances of 5.5.12 running on the same machine for 6
> DK> months without a restart, and that restart 6 months ago was due to a
> DK> power failure.  One of those instances gets around 2 million 
> DK> transactions per day.
> 
>>> I ask that because tomcat with eclipse became unstable twice today.
>>> (May be it was happening because of debugging mode of JVM)
>>>  
>>>
> DK> It's probably not due to tomcat; you have a lot more going on than just
> DK> a tomcat server in that situation.
> 
> DK> Dave
> 
> 
> 
> DK> ---------------------------------------------------------------------
> DK> To start a new topic, e-mail: users@tomcat.apache.org
> DK> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> DK> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

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


Re[2]: How stable is tomcat

Posted by Dima Retov <di...@axisway.com>.
Thanks Dave.

What version of JVM have you used?

Wednesday, November 1, 2006, 8:57:19 PM, you wrote:

DK> Dima Retov wrote:

>>How stable is tomcat with Sun's HotSpot JVM 1.5?
>>
>>Right now we have apache servers that are up for 3 and 4 months.
>>So I guess apache 1.3 may works for months.
>>
>>How stable is tomcat against apache or other webservers?
>>
>>Would tomcat be able to work 1 year without restart?
>>  
>>
DK> I've had three instances of 5.5.12 running on the same machine for 6
DK> months without a restart, and that restart 6 months ago was due to a
DK> power failure.  One of those instances gets around 2 million 
DK> transactions per day.

>>I ask that because tomcat with eclipse became unstable twice today.
>>(May be it was happening because of debugging mode of JVM)
>>  
>>
DK> It's probably not due to tomcat; you have a lot more going on than just
DK> a tomcat server in that situation.

DK> Dave



DK> ---------------------------------------------------------------------
DK> To start a new topic, e-mail: users@tomcat.apache.org
DK> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
DK> For additional commands, e-mail: users-help@tomcat.apache.org



-- 
Best regards,
 Dima                            mailto:dima@axisway.com


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


Re: How stable is tomcat

Posted by Rainer Jung <ra...@kippdata.de>.
I also know a couple of instances which ran under high load for a couple
of months. Usually though the frequency for changes in the apps are
higher than that.

Be careful: I would avoid hot deployment in critical production.

Also: It's not totally unusual for apps to have memory leaks. So minotor
your memory usage in the first weeks to check, if it gets stable.

Regards,

Rainer

David Kerber schrieb:
> Dima Retov wrote:
> 
>> How stable is tomcat with Sun's HotSpot JVM 1.5?
>>
>> Right now we have apache servers that are up for 3 and 4 months.
>> So I guess apache 1.3 may works for months.
>>
>> How stable is tomcat against apache or other webservers?
>>
>> Would tomcat be able to work 1 year without restart?
>>  
>>
> I've had three instances of 5.5.12 running on the same machine for 6
> months without a restart, and that restart 6 months ago was due to a
> power failure.  One of those instances gets around 2 million
> transactions per day.
> 
>> I ask that because tomcat with eclipse became unstable twice today.
>> (May be it was happening because of debugging mode of JVM)
>>  
>>
> It's probably not due to tomcat; you have a lot more going on than just
> a tomcat server in that situation.
> 
> Dave
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org

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


Re: How stable is tomcat

Posted by David Kerber <dc...@verizon.net>.
Dima Retov wrote:

>How stable is tomcat with Sun's HotSpot JVM 1.5?
>
>Right now we have apache servers that are up for 3 and 4 months.
>So I guess apache 1.3 may works for months.
>
>How stable is tomcat against apache or other webservers?
>
>Would tomcat be able to work 1 year without restart?
>  
>
I've had three instances of 5.5.12 running on the same machine for 6 
months without a restart, and that restart 6 months ago was due to a 
power failure.  One of those instances gets around 2 million 
transactions per day.

>I ask that because tomcat with eclipse became unstable twice today.
>(May be it was happening because of debugging mode of JVM)
>  
>
It's probably not due to tomcat; you have a lot more going on than just 
a tomcat server in that situation.

Dave



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


Re: How stable is tomcat

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Dima,

Please don't steal threads. Start a new one next time.

> How stable is tomcat with Sun's HotSpot JVM 1.5?
> 
> How stable is tomcat against apache or other webservers?

They are not directly comparable (Apache httpd and Tomcat) as Tomcat
does things Apache httpd cannot do, and vice versa.

> Would tomcat be able to work 1 year without restart?

My current longest running Tomcat instance was started on May 13th of
this year (running Tomcat 4.1.30 and Java 1.4.2_04 on Linux). The only
reason it hasn't run longer than that is because we perform semi-regular
releases of new features.

With a well-written application, Tomcat can run forever.

-chris



How stable is tomcat

Posted by Dima Retov <di...@axisway.com>.
Wednesday, November 1, 2006, 8:19:07 PM, you wrote:

CS> John,

CS> John Gorkos wrote:
>> On Wednesday 01 November 2006 11:58, Christopher Schultz wrote:
>>> John Gorkos wrote:
>>>> I use per-context JNDI handles to
>>>> the same Postgres database for multiple apps running inside tomcat.  Each
>>>> context.xml sets up connection limits, max idle, etc, slightly
>>> differently.
>>>
>>> You said "per-context JNDI handles", not per-context JNDI DataSources.
>>> Where are you defining your datasource? In context.xml, or in server.xml
>>> with additional, per-context configuration in context.xml?
>>>
>>> Can you show us the configuration for your JNDI DataSource, including

How stable is tomcat with Sun's HotSpot JVM 1.5?

Right now we have apache servers that are up for 3 and 4 months.
So I guess apache 1.3 may works for months.

How stable is tomcat against apache or other webservers?

Would tomcat be able to work 1 year without restart?

I ask that because tomcat with eclipse became unstable twice today.
(May be it was happening because of debugging mode of JVM)


-- 
Best regards,
 Dima                            mailto:dima@axisway.com


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


Re: DBCP Pool not context-specific?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
John,

John Gorkos wrote:
> On Wednesday 01 November 2006 11:58, Christopher Schultz wrote:
>> John Gorkos wrote:
>>> I use per-context JNDI handles to
>>> the same Postgres database for multiple apps running inside tomcat.  Each
>>> context.xml sets up connection limits, max idle, etc, slightly
>> differently.
>>
>> You said "per-context JNDI handles", not per-context JNDI DataSources.
>> Where are you defining your datasource? In context.xml, or in server.xml
>> with additional, per-context configuration in context.xml?
>>
>> Can you show us the configuration for your JNDI DataSource, including
>> the location in whatever file you use? For instance, if you use
>> server.xml, /where/ you do put the <Resource> element?
>>
>> -chris
> 
> Chris - thanks for the quick response.  We've just moved to tomcat 5.5.  I'm 
> using a per-app context XML that looks like this:
>
> <Context crossContext="true" debug="10" docBase="AMDSTools"

It looks like you have your resource defined (correctly) in context.xml,
which is what I would expect do to for context isolation of such a
DataSource.

I wonder if "crossContext=true" muddles this at all? My understanding is
that crossContext="true" basically changes the cookie path from "/myapp"
to "/", and allows a globally-managed session instead of per-context
sessions. I'm grasping at straws, here, since your config at least looks
plausible.

>     <Resource name="jdbc/psql" auth="Container"

Any chance that your JNDI names are colliding with other apps? I dunno
if Tomcat provides JNDI isolation for contexts (although it wouldn't
make any sense not to provide that).

If none of these turns out to be the problem, you may have to re-post
your question. Often, folks on the list assume that a continued
conversation means that the problem is getting solved by someone else,
and might not read it. If you don't get a reply for a day or so, re-post
with some of the extra information you've provided to me.

I'm not an expert when it comes to the subtleties of Tomcat and context
isolation. Who knows... maybe you even found a bug.

-chris



Re: DBCP Pool not context-specific?

Posted by John Gorkos <jo...@sensus.com>.
On Wednesday 01 November 2006 11:58, Christopher Schultz wrote:
> John,
>
> John Gorkos wrote:
> > I use per-context JNDI handles to
> > the same Postgres database for multiple apps running inside tomcat.  Each
> > context.xml sets up connection limits, max idle, etc, slightly
>
> differently.
>
> You said "per-context JNDI handles", not per-context JNDI DataSources.
> Where are you defining your datasource? In context.xml, or in server.xml
> with additional, per-context configuration in context.xml?
>
> Can you show us the configuration for your JNDI DataSource, including
> the location in whatever file you use? For instance, if you use
> server.xml, /where/ you do put the <Resource> element?
>
> -chris

Chris - thanks for the quick response.  We've just moved to tomcat 5.5.  I'm 
using a per-app context XML that looks like this:
<?xml version='1.0' encoding='utf-8'?>
<Context crossContext="true" debug="10" docBase="AMDSTools"
    path="/AMDSTools" reloadable="true" antiJARLocking="true" 
antiResourceLocking="true">
    <Logger className="org.apache.catalina.logger.FileLogger" 
prefix="localhost_log." suffix=".txt" timestamp="true"/>
    <Resource name="jdbc/psql" auth="Container"
            type="javax.sql.DataSource" username="amds" password="XxXxXx"
            factory="org.apache.commons.dbcp.BasicDataSourceFactory"
            driverClassName="org.postgresql.Driver" 
url="jdbc:postgresql://127.0.0.1:5432/amds"
            removeAbandoned="true" removeAbandonedTimeout="2" 
logAbandoned="true"
            maxActive="60" maxIdle="30" maxWait="5000" 
poolPreparedStatements="true"/>
</Context>


My server.xml is untouched from the default distribution of tomcat 5.5.

And yes, I think the term I was searching for was per-context datasources.

John Gorkos


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


Re: DBCP Pool not context-specific?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
John,

John Gorkos wrote:
> I use per-context JNDI handles to 
> the same Postgres database for multiple apps running inside tomcat.  Each 
> context.xml sets up connection limits, max idle, etc, slightly differently.

You said "per-context JNDI handles", not per-context JNDI DataSources.
Where are you defining your datasource? In context.xml, or in server.xml
with additional, per-context configuration in context.xml?

Can you show us the configuration for your JNDI DataSource, including
the location in whatever file you use? For instance, if you use
server.xml, /where/ you do put the <Resource> element?

-chris