Quantcast

Stopping and starting Grails production web apps

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Stopping and starting Grails production web apps

John Moore
In the past I've never had much success simply restarting a single web application (running under Tomcat), as after a couple of times I've tended to run into PermGen errors, etc. Fortunately in the past I've been able to get away with simply restarting Tomcat when I need to make changes to a running web application, as my app has been the only mission-critical one running.

I have a requirement coming up, though, to be able to restart one Grails app occasionally while leaving another one running uninterrupted. One simple way I could do this would be to have two Tomcat instances running. But before going down that path I'm interested in gauging others' experiences with this kind of situation. It may well be that the Tomcat memory problems are a thing of the past now? Or that there is some technique for doing this which avoids the problems, in which case I'd be very interested to hear of it.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Stopping and starting Grails production web apps

ideasculptor
On Sat, Jun 30, 2012 at 5:08 AM, John Moore <[hidden email]> wrote:
In the past I've never had much success simply restarting a single web
application (running under Tomcat), as after a couple of times I've tended
to run into PermGen errors, etc. Fortunately in the past I've been able to
get away with simply restarting Tomcat when I need to make changes to a
running web application, as my app has been the only mission-critical one
running.

I have a requirement coming up, though, to be able to restart one Grails app
occasionally while leaving another one running uninterrupted. One simple way
I could do this would be to have two Tomcat instances running. But before
going down that path I'm interested in gauging others' experiences with this
kind of situation. It may well be that the Tomcat memory problems are a
thing of the past now? Or that there is some technique for doing this which
avoids the problems, in which case I'd be very interested to hear of it.


After many years of tomcat use, I can't claim to have even tried anything other than multiple tomcat instances in recent years.  I use nginx to route between them according to incoming hostname.  If apps are linked such that stopping one will prevent the other from being useful, then I run them in the same container.  I'll also use nginx to load balance between the same app on multiple hosts for redundancy, which will usually allow me to keep apps up even while I restart containers.  Only an update that requires a db schema change that is incompatible with the currently running app will cause me to shut down all instances at once, and those are relatively rare.

--sam


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Stopping and starting Grails production web apps

John Moore
Samuel Gendler wrote
  I use nginx to route
between them according to incoming hostname.  If apps are linked such that
stopping one will prevent the other from being useful, then I run them in
the same container.  I'll also use nginx to load balance between the same
app on multiple hosts for redundancy, which will usually allow me to keep
apps up even while I restart containers.  Only an update that requires a db
schema change that is incompatible with the currently running app will
cause me to shut down all instances at once, and those are relatively rare.
Yes, nginx is part of the plan, and it makes this kind of thing a whole lot easier.  I'm doing the nginx load balancing on another app (not Grails), and it certainly makes it straightforward to take down instances without disrupting service overall.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Stopping and starting Grails production web apps

tomas lin
In reply to this post by John Moore
Tomcat 7 Parallel deployment  -
http://www.javacodegeeks.com/2011/06/zero-downtime-deployment-and-rollback.html

But you might want to think about using DNS to route to parallel
environments, as things like database migrations might require more
thought that just switching tomcats.

On Sat, Jun 30, 2012 at 1:08 PM, John Moore <[hidden email]> wrote:

> In the past I've never had much success simply restarting a single web
> application (running under Tomcat), as after a couple of times I've tended
> to run into PermGen errors, etc. Fortunately in the past I've been able to
> get away with simply restarting Tomcat when I need to make changes to a
> running web application, as my app has been the only mission-critical one
> running.
>
> I have a requirement coming up, though, to be able to restart one Grails app
> occasionally while leaving another one running uninterrupted. One simple way
> I could do this would be to have two Tomcat instances running. But before
> going down that path I'm interested in gauging others' experiences with this
> kind of situation. It may well be that the Tomcat memory problems are a
> thing of the past now? Or that there is some technique for doing this which
> avoids the problems, in which case I'd be very interested to hear of it.
>
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Stopping-and-starting-Grails-production-web-apps-tp4630904.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Stopping and starting Grails production web apps

John Moore
This is very cool. I hadn't come across it before - thanks for pointing it out.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Stopping and starting Grails production web apps

Jonathan Andrew Ong
Hi guys,

Have a question related to this. Assuming nginx in front, and two
tomcat/ app servers behind, how does the session for users become
visible to both apps? Is there a special configuration for this?

Sent from my iPhone

On Jul 1, 2012, at 3:49, John Moore <[hidden email]> wrote:

>
> tomas lin wrote
>>
>> Tomcat 7 Parallel deployment  -
>> http://www.javacodegeeks.com/2011/06/zero-downtime-deployment-and-rollback.html
>>
>
> This is very cool. I hadn't come across it before - thanks for pointing it
> out.
>
>
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Stopping-and-starting-Grails-production-web-apps-tp4630904p4630912.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Stopping and starting Grails production web apps

tomas lin
Not out of the box. You would have to configure tomcat to handle
session replication -
http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html

When we investigated this, we found that you could also opt for using
session-managers that talk to NoSQL databases such as
https://github.com/jcoleman/tomcat-redis-session-manager/ or using a
technology like Terracotta -
http://blogs.mulesoft.org/clustering-tomcat-in-2-minutes-using-tcat-and-terracotta/
. IIRC, Terracotta does have a bit more issues handling large loads
and concurrency compared to a Redis approach.

An alternative to this would probably be to use vanilla Tomcats and
replicate the sessions at the database level using Burt's Database
Sessions plugin - http://grails.org/plugin/database-session/ .



On Sun, Jul 1, 2012 at 4:49 AM, Jonathan Andrew Ong <[hidden email]> wrote:

> Hi guys,
>
> Have a question related to this. Assuming nginx in front, and two
> tomcat/ app servers behind, how does the session for users become
> visible to both apps? Is there a special configuration for this?
>
> Sent from my iPhone
>
> On Jul 1, 2012, at 3:49, John Moore <[hidden email]> wrote:
>
>>
>> tomas lin wrote
>>>
>>> Tomcat 7 Parallel deployment  -
>>> http://www.javacodegeeks.com/2011/06/zero-downtime-deployment-and-rollback.html
>>>
>>
>> This is very cool. I hadn't come across it before - thanks for pointing it
>> out.
>>
>>
>> --
>> View this message in context: http://grails.1312388.n4.nabble.com/Stopping-and-starting-Grails-production-web-apps-tp4630904p4630912.html
>> Sent from the Grails - user mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Stopping and starting Grails production web apps

John Moore
First time I've heard of the Redis session manager. I developed my own for a project a few months back, using Redis as a backing store for sessions which were managed via Shiro.

It seems to me that these days there is a push towards stateless systems, but I have to say that sessions are SO handy and save a lot of extra work. As long as there's a good means of clustering them (and Redis is blazingly fast), and you don't go overboard with saving stuff into sessions and not subsequently clearing it out, I don't really see what the problem is.
Loading...