You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ashkan Rahmani <as...@gmail.com> on 2012/11/19 14:18:10 UTC

multiple tomcat instances for every application

Hi

I have a question.
which way is better for my scenario? I have one server - Centos 6 x64 , 8GB
ram- and 3 java web application.
1- run multiple instances of tomcat 6 for each application and configure
different port in server.xml for each one.
2- run just one instance of tomcat 6 for all three applications by
configuring Catalina.

personally I think solution 2 is far better.

-- 
Best Regards,
Ashkan R

Re: multiple tomcat instances for every application

Posted by Ashkan Rahmani <as...@gmail.com>.
On Tue, Nov 20, 2012 at 5:13 PM, Caldarale, Charles R <
Chuck.Caldarale@unisys.com> wrote:

> > From: Ashkan Rahmani [mailto:ashkan82r@gmail.com]
> > Subject: Re: multiple tomcat instances for every application
>
> > do you know what is  -Xshare:off ?
> > is it related to share classes?
>
> http://lmgtfy.com/?q=%22-Xshare%3Aoff%22
>
> > King Regards,
>
> Didn't realize we were dealing with royalty...
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail and
> its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

http://lmgtfy.com/?q=thank+you.+I+did+it+before.

RE: multiple tomcat instances for every application

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Ashkan Rahmani [mailto:ashkan82r@gmail.com] 
> Subject: Re: multiple tomcat instances for every application

> do you know what is  -Xshare:off ?
> is it related to share classes?

http://lmgtfy.com/?q=%22-Xshare%3Aoff%22

> King Regards,

Didn't realize we were dealing with royalty...

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: multiple tomcat instances for every application

Posted by Ashkan Rahmani <as...@gmail.com>.
On Tue, Nov 20, 2012 at 12:28 AM, Caldarale, Charles R <
Chuck.Caldarale@unisys.com> wrote:

> > From: Christopher Schultz [mailto:chris@christopherschultz.net]
> > Subject: Re: multiple tomcat instances for every application
>
> > Most JVMs use shared memory for some things like core classes, etc.
>
> Unfortunately, I don't think that's true, at least for the Sun/Oracle JVMs
> - only the client JVM uses shared classes, the server JVM does not.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail and
> its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
hi
thank you for reply
do you know what is  -Xshare:off ?
is it related to share classes?
-- 
King Regards,
Ashkan R < ashkan82r@gmail.com >

Re: multiple tomcat instances for every application

Posted by bilguun bayarmagnai <be...@gmail.com>.
If you need a thumb rule, you usually choose multiple instances over
single. Downside is, I think, it only uses little more memory. But else
than that multiple instance is much better choice.

I ran into exactly same issue. But I changed my application instead of
running it multiple times. I separated databases for each users then routed
them accordingly. Edited some logics but now every user has their own
"workspaces" but single app. It is much easier now to develop & maintain.
This also could be an option.

On Tue, Nov 20, 2012 at 5:42 AM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Chuck,
>
> On 11/19/12 3:58 PM, Caldarale, Charles R wrote:
> >> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> >> Subject: Re: multiple tomcat instances for every application
> >
> >> Most JVMs use shared memory for some things like core classes,
> >> etc.
> >
> > Unfortunately, I don't think that's true, at least for the
> > Sun/Oracle JVMs - only the client JVM uses shared classes, the
> > server JVM does not.
>
> Oh, I didn't realize that was a -client thing. Good to know.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with undefined - http://www.enigmail.net/
>
> iEYEARECAAYFAlCqp9UACgkQ9CaO5/Lv0PB70QCeIT8otERge/iDUs9XHAGdHa/5
> beMAoJ7RcLZ3U7wsnVI3oC9AM7Y+O8gz
> =g6a7
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: multiple tomcat instances for every application

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

On 11/19/12 3:58 PM, Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
>> Subject: Re: multiple tomcat instances for every application
> 
>> Most JVMs use shared memory for some things like core classes,
>> etc.
> 
> Unfortunately, I don't think that's true, at least for the
> Sun/Oracle JVMs - only the client JVM uses shared classes, the
> server JVM does not.

Oh, I didn't realize that was a -client thing. Good to know.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlCqp9UACgkQ9CaO5/Lv0PB70QCeIT8otERge/iDUs9XHAGdHa/5
beMAoJ7RcLZ3U7wsnVI3oC9AM7Y+O8gz
=g6a7
-----END PGP SIGNATURE-----

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


RE: multiple tomcat instances for every application

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Subject: Re: multiple tomcat instances for every application

> Most JVMs use shared memory for some things like core classes, etc.

Unfortunately, I don't think that's true, at least for the Sun/Oracle JVMs - only the client JVM uses shared classes, the server JVM does not.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


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


Re: multiple tomcat instances for every application

Posted by javaexp <sa...@gmail.com>.
Ashkan Rahmani <ashkan82r <at> gmail.com> writes:

> 
> very good tank you.

I have written a Java based portable utility for automating the above steps for
<a href="http://www.javaexperience.com/run-multiple-tomcat-instances/">creating
multiple instances</a>. Since Java is platform independent, this utility works
on all operating systems




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


Re: multiple tomcat instances for every application

Posted by Ashkan Rahmani <as...@gmail.com>.
very good tank you.
-- 
King Regards,
Ashkan R < ashkan82r@gmail.com >

Re: multiple tomcat instances for every application

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ashkan,

On 11/19/12 9:10 AM, Ashkan Rahmani wrote:
> On Mon, Nov 19, 2012 at 5:03 PM, Mikolaj Rydzewski <mi...@ceti.pl>
> wrote:
> 
>> On 19.11.2012 14:18, Ashkan Rahmani wrote:
>> 
>> which way is better for my scenario? I have one server - Centos 6
>> x64 ,
>>> 8GB ram- and 3 java web application. 1- run multiple instances
>>> of tomcat 6 for each application and configure different port
>>> in server.xml for each one. 2- run just one instance of tomcat
>>> 6 for all three applications by configuring Catalina.
>>> 
>> 
>> It depends.
>> 
>> It depends on memory usage pattern for your applications - you
>> can tweak GC for each tomcat separately. It depends whether they
>> leak and you need to restart tomcat - and do not want to disturb
>> other ones. It depends on many other factors.
>> 
>> Usually it's enough to go with option 2, but you have to decide
>> yourself.
>> 
>> -- Mikolaj Rydzewski <mi...@ceti.pl>
>> 
>> ------------------------------**------------------------------**---------
>>
>> 
To unsubscribe, e-mail:
users-unsubscribe@tomcat.**apache.org<us...@tomcat.apache.org>
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 
>> 
> yes,  you are right. there are many good reasons. in fact these 3
> apps are actually same, but they are for 3 completely separated
> customers. ( We develop it and then host it for users of
> customers)

Do your customers have any requirements like "you must not host our
data in the same process as other customers"? You might find that you
don't have a choice.

> I googled before, it seams it's really usual run multiple tomcat.

Some environments run multi-Tomcat (we do in our environment), some
run multi-tenant in a single Tomcat. As Mikolaj says, there are good
reasons for choosing either strategy.

We run webapps in separate Tomcat/JVM pairs for stability and
serviceability: we can restart one web application (down to the JVM,
of course) and not disturb any other webapps. We can upgrade,
downgrade, etc. any part of one deployment and not affect other
webapps. A memory leak or other resource exhaustion problem in one
webapp doesn't affect any of the others. These are rare occurrences,
but when they happen it's nice when they don't take-down the other
webapps at the same time.

> I think it's not good. why we run just one httpd for all hosts?

Why *do* you run only one httpd?

Here's one reason: httpd is much more fault-tolerant than Tomcat
(really the JVM), especially in prefork MPM mode: child processes that
encounter problems simply die and are replaced. With Tomcat, an OOME
caused by a single thread can take-down the whole JVM and all
applications running on it.

> I want to say, when I run 3 tomcats, some thing would run 3 times
> in memory.

Most JVMs use shared memory for some things like core classes, etc.
Each process still gets a separate heap, etc. but running multiple
JVMs on the same machine isn't as bad as it sounds.

> but when I run just one, there is one of them. 1 process will be 
> responsible for all Catalinas. of course it's totally depends on
> tomcat architecture.

Tomcat's architecture is not difficult to grasp.

With 3 copies of the same application, this is less of an issue but
one reason you might want to run different Tomcat instances is if you
want to use a different JVM for each application. You may need a huge
heap for one customer and so you want a 64-bit JVM while another
customer only needs a 32-bit JVM. You could save some memory by having
a smaller 64-bit-JVM-heap and a completely separate 32-bit-JVM-heap.

You really have to evaluate your own requirements and make the
decision that fits your situation best. If you think it's best to use
a single JVM/Tomcat deployment, go right ahead and do it: nobody is
going to tell you it's the wrong decision.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlCqlTAACgkQ9CaO5/Lv0PBNKACcDwCV1bcw5LpUB48PGa+nVI24
HnwAni6cDmjt0H2P4Q2EBAu758BipjQe
=Koik
-----END PGP SIGNATURE-----

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


Re: multiple tomcat instances for every application

Posted by Ashkan Rahmani <as...@gmail.com>.
On Mon, Nov 19, 2012 at 5:03 PM, Mikolaj Rydzewski <mi...@ceti.pl> wrote:

> On 19.11.2012 14:18, Ashkan Rahmani wrote:
>
>  which way is better for my scenario? I have one server - Centos 6 x64 ,
>> 8GB
>> ram- and 3 java web application.
>> 1- run multiple instances of tomcat 6 for each application and configure
>> different port in server.xml for each one.
>> 2- run just one instance of tomcat 6 for all three applications by
>> configuring Catalina.
>>
>
> It depends.
>
> It depends on memory usage pattern for your applications - you can tweak
> GC for each tomcat separately.
> It depends whether they leak and you need to restart tomcat - and do not
> want to disturb other ones.
> It depends on many other factors.
>
> Usually it's enough to go with option 2, but you have to decide yourself.
>
> --
> Mikolaj Rydzewski <mi...@ceti.pl>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org<us...@tomcat.apache.org>
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
yes,  you are right.
there are many good reasons. in fact these 3 apps are actually same, but
they are for 3
completely separated customers.
( We develop it and then host it for users of customers)
I googled before, it seams it's really usual run multiple tomcat.
I think it's not good. why we run just one httpd for all hosts? I want to
say, when I run 3 tomcats, some thing would run 3 times in memory.
but when I run just one, there is one of them. 1 process will be
responsible for all Catalinas. of course it's totally depends on tomcat
architecture.


-- 
Best Regards,
Ashkan R

Re: multiple tomcat instances for every application

Posted by Mikolaj Rydzewski <mi...@ceti.pl>.
On 19.11.2012 14:18, Ashkan Rahmani wrote:

> which way is better for my scenario? I have one server - Centos 6 x64 
> , 8GB
> ram- and 3 java web application.
> 1- run multiple instances of tomcat 6 for each application and 
> configure
> different port in server.xml for each one.
> 2- run just one instance of tomcat 6 for all three applications by
> configuring Catalina.

It depends.

It depends on memory usage pattern for your applications - you can 
tweak GC for each tomcat separately.
It depends whether they leak and you need to restart tomcat - and do 
not want to disturb other ones.
It depends on many other factors.

Usually it's enough to go with option 2, but you have to decide 
yourself.

-- 
Mikolaj Rydzewski <mi...@ceti.pl>

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