← Back to team overview

dhis2-devs team mailing list archive

Re: running 11 dhis2 webapps on one tomcat

 

On tomcat I put ALL jars in shared/lib.  And I have this at the bottom
of my server.xml:

        <Context path= "/state1" docBase="/home/bobj/dhis2/dhis.war"></Context>
<!--      <Context path= "/state2"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--       <Context path= "/state3"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state4"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state5"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state6"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state7"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state8"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state9"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state10"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state11"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state12"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state13"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state14"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state15"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state16"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state17"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state18"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state19"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
<!--    <Context path= "/state20"
docBase="/home/bobj/dhis2/dhis.war"></Context> -->
      </Host>
    </Engine>
  </Service>
</Server>

And yes, if I uncomment, I can start all 20 of these instances on my
2M machine without any particular stress on my available Perm space.
They are all sharing the same jar so the difference between 1 and 20
is pretty marginal.  It does take a LONG time to load them all up
though.  Caveats:
1.  I'm not saying this is a good idea!  Just a proof of concept.  One
badly behaved app could bring down all the others.
2.  The big issue now becomes heap usage.  One of the areas we need to
think about optimizing some of the DHIS2 routines is in the use of
heap.  I haven't looked in detail yet, but for example, the reason why
we have sometimes had memory issues with import is that we seem to be
effectively pulling all the data into the heap before flushing the
hibernate cache.  This can be kind of a waste seeing that we are using
a SAX parser for the very reason that we might scale to very large
input streams.  Probably we can look at ways of chunking these sort of
operations to increase scalability.  In fact I'd be very surprised if
the Hibernate cache manager isn't smart enough to do this chunking
already.  Either way this kind of issue is solvable.
3.  Obviously, with the above described arrangement, my database
connections are all messed up.  Still have to sort out the dhis2_home
context init_parameter.

Cheers
Bob

2009/4/10 Knut Staring <knutst@xxxxxxxxx>:
> On Tue, Apr 7, 2009 at 9:47 AM, Bob Jolliffe <bobjolliffe@xxxxxxxxx> wrote:
>>
>> If you pull out all the WEB-INF/lib/*.jar files from the war and place
>> those into tomcat's lib directory you are left with a dhis.war which
>> is only 1.8M.  (I did it on jetty, but same should apply to tomcat).
>
> For some reason, it seems it is not as straightforward as that with tomcat -
> if I move some .jar files from WEB-INF/lib Tomcat doesn't seem to find them
> anymore.
> Knut



Follow ups

References