You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Richard M <rn...@custco.biz> on 2008/08/05 05:21:23 UTC

Can two Tomcat's safely share the same webapps directory?

I looked through the documentation and searched the user list and web for the
answer to this. I found a lot of postings that talked about using NFS
sharing to share the actual Tomcat software directories, but none that dealt
with trying to share an expanded web application between two instances of
Tomcat Actually one Tomcat instance is on a separate machine - using NFS to
mount the directory.

Background: This is a legacy application (somewhat of a content management
system) that places user-uploaded files in the web application directory.
The application is not deployed as a WAR file, just the JSP's and classes
directories are updates as needed. No change to change the app in the
short-term. We are trying to move some batch processing to a separate
instance of Tomcat and want both Tomcat's looking at the same webapps
directory so the second Tomcat instance can mostly read, but possibly update
some of the content files. 

Progress: Well so far it seems to work in preliminary testing. Is there
anything or any reason to shy away from this solution? Both Tomcat's will
have separate work directories. The JSP's will run on the first Tomcat
instance, the batch processing on the second.

Thanks in advance for any ideas, thoughts, etc. - Richard
-- 
View this message in context: http://www.nabble.com/Can-two-Tomcat%27s-safely-share-the-same-webapps-directory--tp18823860p18823860.html
Sent from the Tomcat - User mailing list archive at Nabble.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: Can two Tomcat's safely share the same webapps directory?

Posted by Richard M <rn...@custco.biz>.
Mark, Thanks for the feedback and thoughts. I figured it might not be
supported and a little risky - since I found no references or experiences.
I'll certainly report back if any inherent problems do pop up.


markt-2 wrote:
> 
> Richard M wrote:
>> Progress: Well so far it seems to work in preliminary testing. Is there
>> anything or any reason to shy away from this solution? Both Tomcat's will
>> have separate work directories. The JSP's will run on the first Tomcat
>> instance, the batch processing on the second.
>> 
>> Thanks in advance for any ideas, thoughts, etc. - Richard
> 
> I'd be nervous about this simply because it isn't, as far as I am aware, a 
> requirement that was considered when designing it. That said,
> - separate work dirs are a must and will resolve most (all?) issues and
> you 
> are already doing this
> - sharing a single directory should be OK, sharing a WAR or the entire 
> appBase is likely to be more problematic
> - I assume you are using a context.xml file on at least one instance. If 
> you have one on both, be careful to keep the two in sync
> 
> Other than that, if you testing looks good then you should be OK.
> 
> Just as a word of warning, if you do hit a bug that is caused by the 
> sharing of the dir then depending on the bug it might not get fixed on the 
> grounds that it is an unsupported configuration. Equally, if it is a
> simple 
> fix that has little/no impact then it is likely that it would be applied.
> 
> Good luck!
> 
> Mark
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Can-two-Tomcat%27s-safely-share-the-same-webapps-directory--tp18823860p18831164.html
Sent from the Tomcat - User mailing list archive at Nabble.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: Can two Tomcat's safely share the same webapps directory?

Posted by Mark Thomas <ma...@apache.org>.
Richard M wrote:
> Progress: Well so far it seems to work in preliminary testing. Is there
> anything or any reason to shy away from this solution? Both Tomcat's will
> have separate work directories. The JSP's will run on the first Tomcat
> instance, the batch processing on the second.
> 
> Thanks in advance for any ideas, thoughts, etc. - Richard

I'd be nervous about this simply because it isn't, as far as I am aware, a 
requirement that was considered when designing it. That said,
- separate work dirs are a must and will resolve most (all?) issues and you 
are already doing this
- sharing a single directory should be OK, sharing a WAR or the entire 
appBase is likely to be more problematic
- I assume you are using a context.xml file on at least one instance. If 
you have one on both, be careful to keep the two in sync

Other than that, if you testing looks good then you should be OK.

Just as a word of warning, if you do hit a bug that is caused by the 
sharing of the dir then depending on the bug it might not get fixed on the 
grounds that it is an unsupported configuration. Equally, if it is a simple 
fix that has little/no impact then it is likely that it would be applied.

Good luck!

Mark


---------------------------------------------------------------------
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: Can two Tomcat's safely share the same webapps directory?

Posted by Richard M <rn...@custco.biz>.
Johnny, Thanks for "sharing" this info - good to know it works beyond my
simple tests so far. You bring up a number of good points, things to
consider and test out - e.g. I can see what you mean about the issues of
mid-stream uploads not being handled gracefully in some cases. For us it
should not be a problem they way we are partitioning the workload.


Johnny Kewl wrote:
> 
> 
> ----- Original Message ----- 
> From: "Richard M" <rn...@custco.biz>
> To: <us...@tomcat.apache.org>
> Sent: Tuesday, August 05, 2008 5:21 AM
> Subject: Can two Tomcat's safely share the same webapps directory?
> 
> 
>>
>> I looked through the documentation and searched the user list and web for 
>> the
>> answer to this. I found a lot of postings that talked about using NFS
>> sharing to share the actual Tomcat software directories, but none that 
>> dealt
>> with trying to share an expanded web application between two instances of
>> Tomcat Actually one Tomcat instance is on a separate machine - using NFS 
>> to
>> mount the directory.
>>
>> Background: This is a legacy application (somewhat of a content
>> management
>> system) that places user-uploaded files in the web application directory.
>> The application is not deployed as a WAR file, just the JSP's and classes
>> directories are updates as needed. No change to change the app in the
>> short-term. We are trying to move some batch processing to a separate
>> instance of Tomcat and want both Tomcat's looking at the same webapps
>> directory so the second Tomcat instance can mostly read, but possibly 
>> update
>> some of the content files.
>>
>> Progress: Well so far it seems to work in preliminary testing. Is there
>> anything or any reason to shy away from this solution? Both Tomcat's will
>> have separate work directories. The JSP's will run on the first Tomcat
>> instance, the batch processing on the second.
>>
>> Thanks in advance for any ideas, thoughts, etc. - Richard
> 
> Richard, I got a little Samba link going with a few shared web apps, no
> high 
> traffic, but no problems...
> Ie sharing a webapp only I think will only give you normal issues... like 
> for example, if your uploading file is busy writing to a JSP, and that is 
> viewed at the same time, will probably get a compiler exception... I have 
> never seen one ;) and you can get uploaders to get the whole file before 
> writing it to location, so those are normal issues... if it was an html 
> file, the user may only see half a file, if they just catch it....
> 
> But one thing you cannot do, especially on windows is share the catalina 
> base.... ie the whole TC structure... ie if logs are now trying to share
> the 
> same folder, then I think that is definite problems, especially on a MS 
> system.
> 
> A stupid little test I do on windows, is open files with notepad...
> because 
> notepad holds the lock... you will see that you can open a JSP in notepad 
> and TC will still read it... but with log files, you'll see that windows 
> tells notepad to take a hike... ie one TC owns that log only...
> 
> It will work... you just got to think about how you changing files if it 
> gets really busy... the normal things to worry about..
> 
> TC is made... think about the ~user shared folders for example, for one to 
> drop JSP and html files into it, like say one would when FTPing up to a 
> site... so you can safely expect that to work.... when it comes to servlet 
> classes and things like that... then the fun would really start... because 
> even if you turn on TC's lib change detection, theres dependencies to
> worry 
> about etc.... JSP/HTML... no problem... have fun
> 
> Of course in your software... you want to make sure you access files read 
> only and that you dont hold locks... ie if you batch processing software 
> went an held a JSP file for half an hour... well then TC wouldnt be able
> to 
> get at it, should it want to recompile it... normal stuff ;)
> ---------------------------------------------------------------------------
> HARBOR : http://www.kewlstuff.co.za/index.htm
> The most powerful application server on earth.
> The only real POJO Application Server.
> See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
> ---------------------------------------------------------------------------
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Can-two-Tomcat%27s-safely-share-the-same-webapps-directory--tp18823860p18831240.html
Sent from the Tomcat - User mailing list archive at Nabble.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: Can two Tomcat's safely share the same webapps directory?

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
----- Original Message ----- 
From: "Richard M" <rn...@custco.biz>
To: <us...@tomcat.apache.org>
Sent: Tuesday, August 05, 2008 5:21 AM
Subject: Can two Tomcat's safely share the same webapps directory?


>
> I looked through the documentation and searched the user list and web for 
> the
> answer to this. I found a lot of postings that talked about using NFS
> sharing to share the actual Tomcat software directories, but none that 
> dealt
> with trying to share an expanded web application between two instances of
> Tomcat Actually one Tomcat instance is on a separate machine - using NFS 
> to
> mount the directory.
>
> Background: This is a legacy application (somewhat of a content management
> system) that places user-uploaded files in the web application directory.
> The application is not deployed as a WAR file, just the JSP's and classes
> directories are updates as needed. No change to change the app in the
> short-term. We are trying to move some batch processing to a separate
> instance of Tomcat and want both Tomcat's looking at the same webapps
> directory so the second Tomcat instance can mostly read, but possibly 
> update
> some of the content files.
>
> Progress: Well so far it seems to work in preliminary testing. Is there
> anything or any reason to shy away from this solution? Both Tomcat's will
> have separate work directories. The JSP's will run on the first Tomcat
> instance, the batch processing on the second.
>
> Thanks in advance for any ideas, thoughts, etc. - Richard

Richard, I got a little Samba link going with a few shared web apps, no high 
traffic, but no problems...
Ie sharing a webapp only I think will only give you normal issues... like 
for example, if your uploading file is busy writing to a JSP, and that is 
viewed at the same time, will probably get a compiler exception... I have 
never seen one ;) and you can get uploaders to get the whole file before 
writing it to location, so those are normal issues... if it was an html 
file, the user may only see half a file, if they just catch it....

But one thing you cannot do, especially on windows is share the catalina 
base.... ie the whole TC structure... ie if logs are now trying to share the 
same folder, then I think that is definite problems, especially on a MS 
system.

A stupid little test I do on windows, is open files with notepad... because 
notepad holds the lock... you will see that you can open a JSP in notepad 
and TC will still read it... but with log files, you'll see that windows 
tells notepad to take a hike... ie one TC owns that log only...

It will work... you just got to think about how you changing files if it 
gets really busy... the normal things to worry about..

TC is made... think about the ~user shared folders for example, for one to 
drop JSP and html files into it, like say one would when FTPing up to a 
site... so you can safely expect that to work.... when it comes to servlet 
classes and things like that... then the fun would really start... because 
even if you turn on TC's lib change detection, theres dependencies to worry 
about etc.... JSP/HTML... no problem... have fun

Of course in your software... you want to make sure you access files read 
only and that you dont hold locks... ie if you batch processing software 
went an held a JSP file for half an hour... well then TC wouldnt be able to 
get at it, should it want to recompile it... normal stuff ;)
---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------





---------------------------------------------------------------------
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