Number of Web Applications in one Tomcat

classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Number of Web Applications in one Tomcat

Ahmed, Tarek

Hi all,

TLDR? Do you deploy one web application per tomcat instance or several?

-----------------------

The long story:

I'd like to sound out your opinion regarding the number of web applications deployed in one tomcat instance. The reason is, that at my place of work the developers prefer one webapp per tomcat, the admins would rather have as many webapps as possible in one tomcat instance (yeah, that's devops at its finest ;-)  ). As a developer I'm probably prejudiced, but the argument goes as follows:


OPS (one tomcat, many webapps):

- Saves memory (each tomcat has a memory footprint even without a web application running)

- Saves extra file systems for each tomcat (logs, tomcat installation, temp directory)

- Saves nagios monitoring configuration

- Saves separate ports (security considerations)

- Saves work distributing security patches


DEV (one webapp per tomcat)

- Start-up time of "fat tomcats" multiplies, which leads to worsened availablity (e.g., our fattest tomcat contains 32 web services. It takes 4 minutes to start)

- If one webapp goes haywire, it may crash the rest of them (OOM, no more threads, etc.)

- For bug fixes in one application, you may need to restart the complete tomcat instance. Auto (re)deploy takes you only so far, since loaded classes may not always be unloaded cleanly, threads not closed etc. This is not always something that can be solved in your own code, third party libraries may cause problems, too (we had some issues with quartz and infinispan here).

- If you ever need to profile your application in production, there is much less noise when analysing heap, thread dumps, cpu usage etc.

- I might even think there is some improved security if webapps are isolated in several processes vs. being deployed in one VM (security arguments always work well with OPS :-)  )


So, I want to get away from the one-tomcat-multiple-webapps scenario. One thing I started doing to subvert this policy is using spring boot with embedded tomcats which is cool in a lot of ways but not always feasible.

What are your practices? Are there further pros and cons for one way or the other? Thanks so much for any input,

many greetings,

tarek


--
Signatur
Tarek Ahmed
Softwareentwicklung


DIMDI
Deutsches Institut für
Medizinische Dokumentation und Information
Waisenhausgasse 36-38a
50676 Köln

Tel.: +49 221 4724-268
Fax: +49 221 4724-444

tick Das DIMDI unterstützt die Vereinbarkeit von Beruf und Familie und ist entsprechend zertifiziert.


Das DIMDI ist ein Institut im Geschäftsbereich des Bundesministeriums für Gesundheit (BMG).
Reply | Threaded
Open this post in threaded view
|

RE: Number of Web Applications in one Tomcat

PURVIS, Robert (NHS DIGITAL)
Signatur

We have had a single tomcat with multiple applications (10 or more) for many years (since 2002), and are now separating them. The main reason being that when one application crashes it can bring down the whole tomcat (e.g. oom errors).

 

Robert Purvis
[hidden email]

 

 

From: Ahmed, Tarek <[hidden email]>
Sent: 29 October 2018 08:00
To: [hidden email]
Subject: Number of Web Applications in one Tomcat

 

Hi all,

TLDR? Do you deploy one web application per tomcat instance or several?

-----------------------

The long story:

I'd like to sound out your opinion regarding the number of web applications deployed in one tomcat instance. The reason is, that at my place of work the developers prefer one webapp per tomcat, the admins would rather have as many webapps as possible in one tomcat instance (yeah, that's devops at its finest ;-)  ). As a developer I'm probably prejudiced, but the argument goes as follows:

 

OPS (one tomcat, many webapps):

- Saves memory (each tomcat has a memory footprint even without a web application running)

- Saves extra file systems for each tomcat (logs, tomcat installation, temp directory)

- Saves nagios monitoring configuration

- Saves separate ports (security considerations)

- Saves work distributing security patches

 

DEV (one webapp per tomcat)

- Start-up time of "fat tomcats" multiplies, which leads to worsened availablity (e.g., our fattest tomcat contains 32 web services. It takes 4 minutes to start)

- If one webapp goes haywire, it may crash the rest of them (OOM, no more threads, etc.)

- For bug fixes in one application, you may need to restart the complete tomcat instance. Auto (re)deploy takes you only so far, since loaded classes may not always be unloaded cleanly, threads not closed etc. This is not always something that can be solved in your own code, third party libraries may cause problems, too (we had some issues with quartz and infinispan here).

- If you ever need to profile your application in production, there is much less noise when analysing heap, thread dumps, cpu usage etc.

- I might even think there is some improved security if webapps are isolated in several processes vs. being deployed in one VM (security arguments always work well with OPS :-)  )

 

So, I want to get away from the one-tomcat-multiple-webapps scenario. One thing I started doing to subvert this policy is using spring boot with embedded tomcats which is cool in a lot of ways but not always feasible.

What are your practices? Are there further pros and cons for one way or the other? Thanks so much for any input,

many greetings,

tarek

 

--

Tarek Ahmed

Softwareentwicklung

 

DIMDI

Deutsches Institut für
Medizinische Dokumentation und Information

Waisenhausgasse 36-38a

50676 Köln

 

Tel.: +49 221 4724-268

Fax: +49 221 4724-444

 

Das DIMDI unterstützt die Vereinbarkeit von Beruf und Familie und ist entsprechend zertifiziert.

 

Das DIMDI ist ein Institut im Geschäftsbereich des Bundesministeriums für Gesundheit (BMG).



********************************************************************************************************************

This message may contain confidential information. If you are not the intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in relation to its contents. To do so is strictly prohibited and may be unlawful. Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff in England and Scotland. NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and other accredited email services.

For more information and to find out how you can switch, https://portal.nhs.net/help/joiningnhsmail

Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat

Leon Rosenberg-4
In reply to this post by Ahmed, Tarek
Clearly one webapp per tomcat. Makes everything easier. Also, if your apps aren't really tiny, the memory overhead of tomcat is minimal compared to the advantages.

Leon

On Mon, Oct 29, 2018 at 9:00 AM Ahmed, Tarek <[hidden email]> wrote:

Hi all,

TLDR? Do you deploy one web application per tomcat instance or several?

-----------------------

The long story:

I'd like to sound out your opinion regarding the number of web applications deployed in one tomcat instance. The reason is, that at my place of work the developers prefer one webapp per tomcat, the admins would rather have as many webapps as possible in one tomcat instance (yeah, that's devops at its finest ;-)  ). As a developer I'm probably prejudiced, but the argument goes as follows:


OPS (one tomcat, many webapps):

- Saves memory (each tomcat has a memory footprint even without a web application running)

- Saves extra file systems for each tomcat (logs, tomcat installation, temp directory)

- Saves nagios monitoring configuration

- Saves separate ports (security considerations)

- Saves work distributing security patches


DEV (one webapp per tomcat)

- Start-up time of "fat tomcats" multiplies, which leads to worsened availablity (e.g., our fattest tomcat contains 32 web services. It takes 4 minutes to start)

- If one webapp goes haywire, it may crash the rest of them (OOM, no more threads, etc.)

- For bug fixes in one application, you may need to restart the complete tomcat instance. Auto (re)deploy takes you only so far, since loaded classes may not always be unloaded cleanly, threads not closed etc. This is not always something that can be solved in your own code, third party libraries may cause problems, too (we had some issues with quartz and infinispan here).

- If you ever need to profile your application in production, there is much less noise when analysing heap, thread dumps, cpu usage etc.

- I might even think there is some improved security if webapps are isolated in several processes vs. being deployed in one VM (security arguments always work well with OPS :-)  )


So, I want to get away from the one-tomcat-multiple-webapps scenario. One thing I started doing to subvert this policy is using spring boot with embedded tomcats which is cool in a lot of ways but not always feasible.

What are your practices? Are there further pros and cons for one way or the other? Thanks so much for any input,

many greetings,

tarek


--
Tarek Ahmed
Softwareentwicklung


DIMDI
Deutsches Institut für
Medizinische Dokumentation und Information
Waisenhausgasse 36-38a
50676 Köln

Tel.: +49 221 4724-268
Fax: +49 221 4724-444

Das DIMDI unterstützt die Vereinbarkeit von Beruf und Familie und ist entsprechend zertifiziert.


Das DIMDI ist ein Institut im Geschäftsbereich des Bundesministeriums für Gesundheit (BMG).
Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat

Olaf Kock
In reply to this post by Ahmed, Tarek

On 29.10.18 09:00, Ahmed, Tarek wrote:
>
> TLDR? Do you deploy one web application per tomcat instance or several?
>
As you list the arguments quite well, I'd add my answer "it depends":
General rule of thumb, to be executed in that order: If they're too few
applications to worry about (and if they're stable): Don't worry, One
server.

If they're completely unrelated and have different stakeholders and/or
maintenance intervals: That's a good argument for multiple servers

If there are unstable applications (in the sense of actively maintained,
forcing frequent redeployments): Another good argument for multiple servers.

If there have been problems in the past with load/memory etc: Good
argument for multiple servers.

This /might/ end up as one app per server, but the number one is not the
end goal. There are typically some related apps, with the same
maintenance intervals and stakeholders - unless one of them is
problematic, I group them together.

I hope that helps.

Olaf


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat

markt
In reply to this post by Ahmed, Tarek
On 29/10/18 08:00, Ahmed, Tarek wrote:
> Hi all,
>
> TLDR? Do you deploy one web application per tomcat instance or several?

No firm opinion one way or the other, just some commentary.

> -----------------------
>
> The long story:
>
> I'd like to sound out your opinion regarding the number of web
> applications deployed in one tomcat instance. The reason is, that at my
> place of work the developers prefer one webapp per tomcat, the admins
> would rather have as many webapps as possible in one tomcat instance
> (yeah, that's devops at its finest ;-)  ). As a developer I'm probably
> prejudiced, but the argument goes as follows:
>
>
> OPS (one tomcat, many webapps):
>
> - Saves memory (each tomcat has a memory footprint even without a web
> application running)

The Tomcat overhead is <20MB. Apps are typically a lot more. This
doesn't look like a strong argument to me.

> - Saves extra file systems for each tomcat (logs, tomcat installation,
> temp directory)

The resources in question are small in number and size. Again, this
doesn't look like a strong argument to me.

> - Saves nagios monitoring configuration

This is an interesting one. How well can the monitoring distinguish one
app from another. Given shared memory, shared thread-pools etc., per app
details could be tricky to determine.

> - Saves separate ports (security considerations)

I don't follow the argument here.

> - Saves work distributing security patches

A split CATALINA_HOME / CATALINA_BASE approach can help a lot with this
issue.
https://tomcat.apache.org/tomcat-9.0-doc/introduction.html#CATALINA_HOME_and_CATALINA_BASE


> DEV (one webapp per tomcat)
>
> - Start-up time of "fat tomcats" multiplies, which leads to worsened
> availablity (e.g., our fattest tomcat contains 32 web services. It takes
> 4 minutes to start)

You can configure Tomcat to load applications in parallel to reduce this
impact.

> - If one webapp goes haywire, it may crash the rest of them (OOM, no
> more threads, etc.)

Fair point.

> - For bug fixes in one application, you may need to restart the complete
> tomcat instance. Auto (re)deploy takes you only so far, since loaded
> classes may not always be unloaded cleanly, threads not closed etc. This
> is not always something that can be solved in your own code, third party
> libraries may cause problems, too (we had some issues with quartz and
> infinispan here).

These issues usually are solvable but you need to know about them in
advance to code the necessary workarounds / protections.

> - If you ever need to profile your application in production, there is
> much less noise when analysing heap, thread dumps, cpu usage etc.

Fair point.

> - I might even think there is some improved security if webapps are
> isolated in several processes vs. being deployed in one VM (security
> arguments always work well with OPS :-)  )

Possibly. The strength of the security argument depends on the
circumstances. I suspect OPS can construct an equally strong security
based argument for single instances.

> So, I want to get away from the one-tomcat-multiple-webapps scenario.
> One thing I started doing to subvert this policy is using spring boot
> with embedded tomcats which is cool in a lot of ways but not always
> feasible.
>
> What are your practices? Are there further pros and cons for one way or
> the other? Thanks so much for any input,

I've configured Tomcat instances both ways in the past depending on
circumstances. Generally, the more resources an app uses, the more
likely I am to have an app per instance the more business critical the
app is, the more likely I am to use a dedicated instance. Otherwise, I
tend to opt for a single instance for ease of management.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat

Ahmed, Tarek
sorry, didn't send this to the list, but to mark's address,
t.

Am 29.10.18 um 10:18 schrieb Mark Thomas:
On 29/10/18 08:00, Ahmed, Tarek wrote:

DEV (one webapp per tomcat)

- Start-up time of "fat tomcats" multiplies, which leads to worsened
availablity (e.g., our fattest tomcat contains 32 web services. It takes
4 minutes to start)
You can configure Tomcat to load applications in parallel to reduce this
impact.
Thanks, Mark, this is a really valuable hint. I checked if there was such a possibility several years ago but either I didn't find it or it was before v. 7.023. I tried it out now and first tests show that a speed-up of 200% is possible (have to tweak the optimal number of threads yet). This is not a solution for a lot of my other issues but it does  make living with fat tomcats easier.
tarek

--
Tarek Ahmed
Softwareentwicklung


DIMDI
Deutsches Institut für
Medizinische Dokumentation und Information
Waisenhausgasse 36-38a
50676 Köln

Tel.: +49 221 4724-268
Fax: +49 221 4724-444

tick Das DIMDI unterstützt die Vereinbarkeit von Beruf und Familie und ist entsprechend zertifiziert.


Das DIMDI ist ein Institut im Geschäftsbereich des Bundesministeriums für Gesundheit (BMG).
Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat

Christopher Schultz-2
In reply to this post by Ahmed, Tarek
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Tarek,

On 10/29/18 04:00, Ahmed, Tarek wrote:
> Hi all,
>
> TLDR? Do you deploy one web application per tomcat instance or
> several?

I usually deploy one webapp per JVM/tomcat instance. I do this so that
a problem in one webapp doesn't take-down the others. It's as simple
as that. The other benefits are being able to service that one JVM
without taking down N webapps -- just one, and also being able to run
under different JVMs, system libraries, etc. without having to test
each application for compatibility.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlvXDYMACgkQHPApP6U8
pFgNgw/+O790RNVYpFtPKotyUT4ucPJbuVgYRcj/h+xcbw2REZurFzinXv82JSf7
A5m2zDYWLKFNi3x5Wu7rEWZvWc7xTCBz2E2BiwV9jfFX/Los8zuk3xo0xzHOJSFR
bNHnVLLws1Uj44dcsdYS4R6ZqZvJkgWTI9fnDlg0WbKW2zXscxgGO/+5887SrEB7
bgvwibe1tyBLosn+Sfx6O0Pab7w206OT8MHK+eFtXeE68bkfr1re4ykZV/DTTE4n
nEMCbysC7M2CCNElkQZNUe4MEIo9UWXkVnpj7zK3sVa9teawFWrZAx2uxGV/gsQX
PL+PqS6AAcQJh5Tesao/KjE83mjGGF0+CjuN1jl68g7U4rhCVPJSThsA11JxIcv4
jxJtPDbygK+11YBxaQZJY5QaeIvmnFQEaA5Svo/Em6HXOfqZHl9QJERdKQErMM5x
2O/8bwOIvYGShEOn2FwMYTMo1UPv9Yeek1BHXGtGdOhuw0/udVbFdCB6uh416uy3
xHfA2hJEXq/gnqJRWDjTj5lEEKAaXAkTm+FjaOW0VQMKKDNT3DKVs3vIpWfsSNnK
qlk4PFRgDZrp3A8OT+MX39lcMrSdvra9zU5lg1nALVrZDP7I2FTI55QNSqCzpo76
cCybiyWgy4urq5fokprewjHwrQzMiE1lKXS9RfrdVSVwYToyi1E=
=5z9/
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat

Mark H. Wood
In reply to this post by Ahmed, Tarek
On Mon, Oct 29, 2018 at 09:00:27AM +0100, Ahmed, Tarek wrote:
> TLDR? Do you deploy one web application per tomcat instance or several?

We have one production host with several related webapp.s in a single
Tomcat instance, and another production host with three instances of
that same single product (i.e. clumps of related webapp.s) in a single
Tomcat instance.  It works well.

In development I have at times as many as a dozen of those clumps
running in a single Tomcat, alongside various other applications also
in that single Tomcat.  It rarely causes trouble, and in development I
can always bounce it if I need to.

A couple of comments:

o  "loaded classes may not always be unloaded cleanly, threads not
   closed etc."  If I have this, it is either (a) an application bug,
   which I should fix, or (b) a buggy dependency, which I should
   report and complain about until fixed (or replaced).

o  An additional problem with multiple applications per container:
   ill-designed dependencies which are only configurable using system
   properties, when different applications need different
   configurations.

--
Mark H. Wood
Lead Technology Analyst

University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat

isapir
In reply to this post by Christopher Schultz-2
Tarek,

On 10/29/2018 2:04 AM, Leon Rosenberg wrote:
> Clearly one webapp per tomcat. Makes everything easier. Also, if your
> apps aren't really tiny, the memory overhead of tomcat is minimal
> compared to the advantages.

+1

On 10/29/2018 6:39 AM, Christopher Schultz wrote:
> I usually deploy one webapp per JVM/tomcat instance. I do this so that
> a problem in one webapp doesn't take-down the others. It's as simple
> as that. The other benefits are being able to service that one JVM
> without taking down N webapps -- just one, and also being able to run
> under different JVMs, system libraries, etc. without having to test
> each application for compatibility.

+1

Also, if you end up with a much larger heap because you put a bunch of
applications together, then you can run into longer GC cycles (can
happen even with concurrent garbage collectors).  When you have a Full
GC, all of your applications' threads stop, and if it takes long enough,
i.e. more than a fraction of a second, the lack of responsiveness of the
applications will become noticeable.

The whole is greater than the sum of its parts, just that in this case
"greater" is a bad thing.

Igal


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat: THANKS!

Ahmed, Tarek
In reply to this post by Ahmed, Tarek
Thanks for your input!

To summarize: Most of us seem to prefer not to have too many web
applications running in one tomcat instance. If, however, it is possible
to run a tomcat with many applications in a stable way it reduces
administrative overhead to do so. The prerequisites for this are that
the applications are mature, handle resources well and don't get too
many updates (we _do_ regular dependency updates, though ...).

On the other hand, if there is - for whatever reason - a regular need of
restarts or re-deployments or if the applications deployed need
individual monitoring or special care or whatever, there is a case for
one application per tomcat.

What do I make of this? There might be a compromise here: Identify those
applications that don't cause trouble and put them into one tomcat
instance. Everything else (new applications, buggy ones no one bothers
to fix anymore, applications that get regular feature updates etc.) are
isolated in their own tomcat instances. As soon as those become stable
we can move them to (one of) the fat tomcat(s).

Sounds like something I might get through :-)

Thanks and greetings,
tarek

Am 29.10.18 um 09:00 schrieb Ahmed, Tarek:
>
> Hi all,
>
> TLDR? Do you deploy one web application per tomcat instance or several?
>
[...]



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[OT] Re: Number of Web Applications in one Tomcat: THANKS!

André Warnier (tomcat)
On 30.10.2018 08:13, Ahmed, Tarek wrote:

> Thanks for your input!
>
> To summarize: Most of us seem to prefer not to have too many web
> applications running in one tomcat instance. If, however, it is possible
> to run a tomcat with many applications in a stable way it reduces
> administrative overhead to do so. The prerequisites for this are that
> the applications are mature, handle resources well and don't get too
> many updates (we _do_ regular dependency updates, though ...).
>
> On the other hand, if there is - for whatever reason - a regular need of
> restarts or re-deployments or if the applications deployed need
> individual monitoring or special care or whatever, there is a case for
> one application per tomcat.
>
> What do I make of this? There might be a compromise here: Identify those
> applications that don't cause trouble and put them into one tomcat
> instance. Everything else (new applications, buggy ones no one bothers
> to fix anymore, applications that get regular feature updates etc.) are
> isolated in their own tomcat instances. As soon as those become stable
> we can move them to (one of) the fat tomcat(s).
>
> Sounds like something I might get through :-)
>

And somehow, this sounds a lot like Java GC.  It should be possible to automate this..

> Thanks and greetings,
> tarek
>
> Am 29.10.18 um 09:00 schrieb Ahmed, Tarek:
>>
>> Hi all,
>>
>> TLDR? Do you deploy one web application per tomcat instance or several?
>>
> [...]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat

logo
In reply to this post by markt
Mark,

<snip>

>> DEV (one webapp per tomcat)
>>
>> - Start-up time of "fat tomcats" multiplies, which leads to worsened
>> availablity (e.g., our fattest tomcat contains 32 web services. It
>> takes
>> 4 minutes to start)
>
> You can configure Tomcat to load applications in parallel to reduce
> this
> impact.
>
<snip>

do you mind to tell me how? Or what option to search for?

Thank you.

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat

Ahmed, Tarek
Am 30.10.18 um 13:13 schrieb logo:

> Mark,
>
> <snip>
>
>>> DEV (one webapp per tomcat)
>>>
>>> - Start-up time of "fat tomcats" multiplies, which leads to worsened
>>> availablity (e.g., our fattest tomcat contains 32 web services. It
>>> takes
>>> 4 minutes to start)
>>
>> You can configure Tomcat to load applications in parallel to reduce this
>> impact.
>>
> <snip>
>
> do you mind to tell me how? Or what option to search for?

Since I've already searched (and found it): Look at this page:
https://wiki.apache.org/tomcat/HowTo/FasterStartUp#Starting_several_web_applications_in_parallel

"With Tomcat 7.0.23+ you can configure it to start several web
applications in parallel. This is disabled by default but can be enabled
by setting the startStopThreads attribute of a *Host* to a value greater
than one."

cheers,

tarek


Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat

Torsten Krah-2
Am Dienstag, den 30.10.2018, 14:39 +0100 schrieb Ahmed, Tarek:
> "With Tomcat 7.0.23+ you can configure it to start several web
> applications in parallel. This is disabled by default but can be
> enabled
> by setting the startStopThreads attribute of a *Host* to a value
> greater
> than one."

But be aware that you may run into problem with this one - look e.g.
here:

https://www.mail-archive.com/users@.../msg127141.html

Cheers

Torsten

smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Number of Web Applications in one Tomcat

Jäkel, Guido
>-----Original Message-----
>From: Torsten Krah [mailto:[hidden email]]
>Sent: Tuesday, October 30, 2018 2:55 PM
>To: [hidden email]
>Subject: Re: Number of Web Applications in one Tomcat
>
>Am Dienstag, den 30.10.2018, 14:39 +0100 schrieb Ahmed, Tarek:
>> "With Tomcat 7.0.23+ you can configure it to start several web
>> applications in parallel. This is disabled by default but can be
>> enabled
>> by setting the startStopThreads attribute of a *Host* to a value
>> greater
>> than one."
>
>But be aware that you may run into problem with this one - look e.g.
>here:
>
>https://www.mail-archive.com/users@.../msg127141.html
>
>Cheers
>
>Torsten

I'm pretty sure that this problem is just caused by malformed applications that include some XML stuff inside the application that MUST NOT include, but have to be provided instead by the platform -- e.g. as JVM endorsed libs. A common case is that application A provide and register some implementation of an API at JVM level and application B provide this also, but with another version. Then, one of the application will use at runtime another lib as at compile time.

Without parallel start, this might seem to work (or not) in a stable way. But with parallel start, you get race conditions.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat

Torsten Krah-2
Am Dienstag, den 30.10.2018, 15:13 +0000 schrieb Jäkel, Guido:

> I'm pretty sure that this problem is just caused by malformed
> applications that include some XML stuff inside the application that
> MUST NOT include, but have to be provided instead by the platform --
> e.g. as JVM endorsed libs. A common case is that application A
> provide and register some implementation of an API at JVM level and
> application B provide this also, but with another version. Then, one
> of the application will use at runtime another lib as at compile
> time.
>
> Without parallel start, this might seem to work (or not) in a stable
> way. But with parallel start, you get race conditions.
The whole xml stack used is from the JVM (no custom xerces, xalan etc
added to WEB-INF/lib) - so i don't know where to look for something
which should not be in "my" local libs.

And there is no ClasscastException or LinkageError here - its the
parser itself who does fail:

Caused by: org.xml.sax.SAXParseException; lineNumber: 476;
columnNumber:
97; src-resolve: Name 'ehcache:resource-unit' kann nicht als 'type
definition'-Komponente aufgelöst werden.

But i am happy to continue that discussion in the original thread
because i am still interested in getting the root cause because at the
moment parallel startup is disabled because of that error.

Cheers

Torsten

smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat: THANKS!

Christopher Schultz-2
In reply to this post by Ahmed, Tarek
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Tarek,

On 10/30/18 03:13, Ahmed, Tarek wrote:

> Thanks for your input!
>
> To summarize: Most of us seem to prefer not to have too many web
> applications running in one tomcat instance. If, however, it is
> possible to run a tomcat with many applications in a stable way it
> reduces administrative overhead to do so. The prerequisites for
> this are that the applications are mature, handle resources well
> and don't get too many updates (we _do_ regular dependency updates,
> though ...).
>
> On the other hand, if there is - for whatever reason - a regular
> need of restarts or re-deployments or if the applications deployed
> need individual monitoring or special care or whatever, there is a
> case for one application per tomcat.
>
> What do I make of this? There might be a compromise here: Identify
> those applications that don't cause trouble and put them into one
> tomcat instance. Everything else (new applications, buggy ones no
> one bothers to fix anymore, applications that get regular feature
> updates etc.) are isolated in their own tomcat instances. As soon
> as those become stable we can move them to (one of) the fat
> tomcat(s).
>
> Sounds like something I might get through :-)
>
> Thanks and greetings, tarek
>
> Am 29.10.18 um 09:00 schrieb Ahmed, Tarek:
>>
>> Hi all,
>>
>> TLDR? Do you deploy one web application per tomcat instance or
>> several?
>>

Has anyone ever attacked one of your web applications? There are some
fun ways to make an application use a huge amount of memory. Just
because the applications themselves are behaving doesn't mean that all
the users are behaving.

For example, do you have a max POST size set for your application? If
not, I can send your login form a username that is so long it might
exhaust your heap. 2147483647 characters is a LOT of characters.

If you have a max POST size, maybe you don't filter-out PUT requests,
and have Tomcat parsing those for you. Same problem, there.

Just some thing to think about. Most web applications haven't really
been exercised by someone who knows what might break it. Can you
afford for those applications to take each other down because the JVM
becomes unstable? Maybe and maybe not.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlvYlTwACgkQHPApP6U8
pFi2uQ/+JTpVnGKJkQTRDyq4XQIXERDmTRJ0ZlIc8z3pFgjGq3QePvjq+EF5c8Vi
O7SCHnti/z/PMNTjLVsDH+Z828BV7nvIteD3+AzG5YQoWTavTeaq/LHPKdvUX/DP
1UDWPYNeFzpp7+bbt0aLlRgO488WaZeYjqwNHlyyLilnqgJbLIw477BmKFXDS+ur
16hUWzti1Hjt6anuQhNavZQPU88UuRNU0GiY4+7ns+kq8to+qxqJS8soP9RNPJ5a
FvS/YwpyMSDcNelzWrADAsEaqA8A0p0iBUFhB05kPPh3xjKAA2qt8p1P6EBgcWgo
JUP4KUh2wGpD6izluVS6TDBtJunMoI9mMGhwgfyLHs6G0sH6e4c3YSxsMxWbCn9A
vWwFyKF4qfDDKsaX9DJ5m4ldsxvWtB3/5PZ4AmYf9HqsiCz9k6zzANBnbL2sMos6
jKuqyF34ahFV5MX0SnN6DUtCUSOkqWK0BcBAK5kUevt9/ouwUnssti4cKBNQiRFy
Ss1YGfbf8m6JJ14K2BqteCLe1tekDJ8z9uPzqug9QNqJ5T4pLAYM6eXkpTXfDjtQ
pyqPKRR+YAHRqcbCeva/D85DVXFDIvXoIJVvW7lvZXAve6zwHzYFr5JO4lizFXXW
RZepakYb7Kph9GIPsDPhISr2PqwLY+wCVVpRRuLDvCW1K6Xk2i8=
=/x7Y
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat: THANKS!

Ahmed, Tarek
Christopher,

Am 30.10.18 um 18:30 schrieb Christopher Schultz:

> Has anyone ever attacked one of your web applications? There are some
> fun ways to make an application use a huge amount of memory. Just
> because the applications themselves are behaving doesn't mean that all
> the users are behaving.
>
> For example, do you have a max POST size set for your application? If
> not, I can send your login form a username that is so long it might
> exhaust your heap. 2147483647 characters is a LOT of characters.
>
> If you have a max POST size, maybe you don't filter-out PUT requests,
> and have Tomcat parsing those for you. Same problem, there.
>
> Just some thing to think about. Most web applications haven't really
> been exercised by someone who knows what might break it. Can you
> afford for those applications to take each other down because the JVM
> becomes unstable? Maybe and maybe not.

I have to assume that our applications are attacked, though so far at
least we have no knowledge of serious incidences. The security measures
taken in the individual applications vary with the security awareness of
the programming team responsible (and, of course, the criticality of the
application).

We are working on increasing this awareness but this is a slow and
ongoing process, and, of course, anyone really competent at hacking web
applications usually finds jobs that are better paid than software
development, so we, as mostly everyone else, will always lag behind.

Anyway, thanks for the additional argument and for the hint regarding
maxPostSize. This
http://tomcat.apache.org/tomcat-8.5-doc/config/http.html, though, says,
its set to 2097152 characters, which is still a lot of bytes and more
than most applications need. I'll check, how we handle that :-)

greetings,

tarek




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Number of Web Applications in one Tomcat: THANKS!

Jäkel, Guido
In reply to this post by Christopher Schultz-2
>Has anyone ever attacked one of your web applications? There are some
>fun ways to make an application use a huge amount of memory. Just
>because the applications themselves are behaving doesn't mean that all
>the users are behaving.
>
>For example, do you have a max POST size set for your application? If
>not, I can send your login form a username that is so long it might
>exhaust your heap. 2147483647 characters is a LOT of characters.
>
>If you have a max POST size, maybe you don't filter-out PUT requests,
>and have Tomcat parsing those for you. Same problem, there.

Dear Chris,

But that's no argument for or against running more than one application per Tomcat: If you're not aware of such things, one may attack your other Tomcats in the same way because of identical configuration. Of course, if you plan to run a couple of applications per Tomcat, you may also plan to spread it to more than instance to have a fail-over or load balancing . But even if you use a HA-cluster with one App per cluster member: If one is able to crash the Application by a Request on one cluster member, this might be repeated on the other members without noteworthy costs.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Number of Web Applications in one Tomcat

logo
In reply to this post by Ahmed, Tarek
Tarek,

Am 30.10.2018 14:39, schrieb Ahmed, Tarek:

> Am 30.10.18 um 13:13 schrieb logo:
>> Mark,
>>
>> <snip>
>>
>>>> DEV (one webapp per tomcat)
>>>>
>>>> - Start-up time of "fat tomcats" multiplies, which leads to worsened
>>>> availablity (e.g., our fattest tomcat contains 32 web services. It
>>>> takes
>>>> 4 minutes to start)
>>>
>>> You can configure Tomcat to load applications in parallel to reduce
>>> this
>>> impact.
>>>
>> <snip>
>>
>> do you mind to tell me how? Or what option to search for?
>
> Since I've already searched (and found it): Look at this page:
> https://wiki.apache.org/tomcat/HowTo/FasterStartUp#Starting_several_web_applications_in_parallel
>
> "With Tomcat 7.0.23+ you can configure it to start several web
> applications in parallel. This is disabled by default but can be
> enabled
> by setting the startStopThreads attribute of a *Host* to a value
> greater
> than one."
>
> cheers,
>
> tarek

that's nice, Thanks

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

12