You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ray Holme <rh...@roadrunner.com> on 2009/02/02 13:59:38 UTC

tomcat 5 and the JVM

I run tomcat 6 on Linux and have multiple applications in development
mode. From my testing I have discovered that a Java bean shared by all
applications and with ALL methods as static SEEMS to have  a separate
instance for each appliction - i.e.

   getDebugLevel() returns 0 from the 2nd application
                   even if the first has set it to 100

This is useful but contrary to what I would expect. I would expect one
JVM for all applications. If there is one per application, that too is
cool, but it means that each application must do a

  System.gc()

occasionally and that this routine cannot be done once for all.

So, does someone know for sure - one JVM per Tomcat OR one JVM per app??


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


Re: tomcat 5 and the JVM

Posted by Ray Holme <rh...@roadrunner.com>.
thanks - removed
On Mon, 2009-02-02 at 14:46 +0100, Felix Schumacher wrote:
> Hi Ray,
> 
> On Mon, February 2, 2009 1:59 pm, Ray Holme wrote:
> > I run tomcat 6 on Linux and have multiple applications in development
> > mode. From my testing I have discovered that a Java bean shared by all
> > applications and with ALL methods as static SEEMS to have  a separate
> > instance for each appliction - i.e.
> look at
> http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
> 
> > cool, but it means that each application must do a
> >   System.gc()
> If you have to do a System.gc() by yourself, you (most) probably did
> something wrong with your Bean. And be careful with that call. First the
> jvm is free to ignore it. Second it can be a major performance hit. We
> once found an application to call System.gc() with every get|post call. We
> disabled the System.gc() functionality by starting the jvm with 
> -XX:+DisableExplicitGC.
> 
> Bye
>  Felix
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


Re: tomcat 5 and the JVM

Posted by Felix Schumacher <fe...@internetallee.de>.
Hi Ray,

On Mon, February 2, 2009 1:59 pm, Ray Holme wrote:
> I run tomcat 6 on Linux and have multiple applications in development
> mode. From my testing I have discovered that a Java bean shared by all
> applications and with ALL methods as static SEEMS to have  a separate
> instance for each appliction - i.e.
look at
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html

> cool, but it means that each application must do a
>   System.gc()
If you have to do a System.gc() by yourself, you (most) probably did
something wrong with your Bean. And be careful with that call. First the
jvm is free to ignore it. Second it can be a major performance hit. We
once found an application to call System.gc() with every get|post call. We
disabled the System.gc() functionality by starting the jvm with 
-XX:+DisableExplicitGC.

Bye
 Felix


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


Re: tomcat 5 and the JVM

Posted by Ray Holme <rh...@roadrunner.com>.
thanks - makes sense.

removed the GC call as someone else put it there a long time ago

also removed System.runFinalization()  - assume this is not something to
do in my "garbage sweep" where I check for other things.

:=]
On Mon, 2009-02-02 at 14:45 +0100, Kees de Kooter wrote:
> Hi Ray,
> 
> It is one JVM, but separate classloaders so applications do not "see"
> classes of other apps.
> 
> Oh and please be extremely careful with using System.gc(). Using it
> can lead to severe and unexpected performance issues. If you "need"
> gc() you almost always have a flaw in your code.
> 
> Cheers,
> Kees de Kooter
> http://www.boplicity.net
> 
> 
> 
> On Mon, Feb 2, 2009 at 13:59, Ray Holme <rh...@roadrunner.com> wrote:
> > I run tomcat 6 on Linux and have multiple applications in development
> > mode. From my testing I have discovered that a Java bean shared by all
> > applications and with ALL methods as static SEEMS to have  a separate
> > instance for each appliction - i.e.
> >
> >   getDebugLevel() returns 0 from the 2nd application
> >                   even if the first has set it to 100
> >
> > This is useful but contrary to what I would expect. I would expect one
> > JVM for all applications. If there is one per application, that too is
> > cool, but it means that each application must do a
> >
> >  System.gc()
> >
> > occasionally and that this routine cannot be done once for all.
> >
> > So, does someone know for sure - one JVM per Tomcat OR one JVM per app??
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


Re: tomcat 5 and the JVM

Posted by Kees de Kooter <kd...@gmail.com>.
Hi Ray,

It is one JVM, but separate classloaders so applications do not "see"
classes of other apps.

Oh and please be extremely careful with using System.gc(). Using it
can lead to severe and unexpected performance issues. If you "need"
gc() you almost always have a flaw in your code.

Cheers,
Kees de Kooter
http://www.boplicity.net



On Mon, Feb 2, 2009 at 13:59, Ray Holme <rh...@roadrunner.com> wrote:
> I run tomcat 6 on Linux and have multiple applications in development
> mode. From my testing I have discovered that a Java bean shared by all
> applications and with ALL methods as static SEEMS to have  a separate
> instance for each appliction - i.e.
>
>   getDebugLevel() returns 0 from the 2nd application
>                   even if the first has set it to 100
>
> This is useful but contrary to what I would expect. I would expect one
> JVM for all applications. If there is one per application, that too is
> cool, but it means that each application must do a
>
>  System.gc()
>
> occasionally and that this routine cannot be done once for all.
>
> So, does someone know for sure - one JVM per Tomcat OR one JVM per app??
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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