users@grizzly.java.net

Re: [Jersey] Re: hot class reloading

From: Robert DiFalco <robert.difalco_at_gmail.com>
Date: Wed, 19 Mar 2014 20:17:51 -0700

Yup, that's what we do too. I second the idea that maybe what's needed here
is some better DevOps kung-fu rather than a more complicated running server.


On Wed, Mar 19, 2014 at 8:07 PM, Kevin Duffey <andjarnic_at_yahoo.com> wrote:

> Maybe I am missing something, but usually in production, you have at least
> 2 servers for fail over reasons. If this is the case, you take one down,
> deploy the latest, bring it back up then take the 2nd one down (or next
> one), redeploy, etc. Or, you could just have the auto-redeploy feature
> turned on since you typically don't deploy to a production server too
> often. The one thing you gotta watch out for if you do this is perm-gen
> space. Glassfish I think defaulted to 128MB or something. Bumping that up a
> few notches would be good in case you deploy more frequently. Also, make
> sure you run all the server optimizations for java such as -server and so
> forth.
>
> If you're running only a single server, and you own the hardware, set up a
> linux KVM setup with 2 or more KVM instances and use one KVM for a load
> balancer if you don't have a physical one, with at least 2, if not 3
> instances of your web server. Today's cheap server hardware can handle
> several VMs at once, and it gives you the ability to fail over and load
> balance at least on your physical machine. A better option is using two
> physical servers each with a couple VM instances.. or just deploy to the
> cloud. Amazon is typical but VMware has some very easy to use cloud
> services as well and VMware are the masters behind virtualization and vloud
> computing.
>
>
>
>
> On Wednesday, March 19, 2014 6:59 PM, Oleksiy Stashok <
> oleksiy.stashok_at_oracle.com> wrote:
>
> Adding Jersey mailing list in case anyone has experience with that.
>
> Just my guess is that you probably have to split resources jar out of
> main jar and replace and reload only resources, not entire jar.
>
> Thanks.
>
> WBR,
> Alexey.
>
> On 18.03.14 13:26, Andrew Munn wrote:
> > What is the best way to reload some part of the web facing portion of an
> > app running in production without taking the Grizzly/Jersey server down?
> >
> > I'm doing this:
> >
> > Set<Class<?>> classes = new HashSet<>();
> > classes.add(myapp.MyClass.class);
> > classes.add(myapp.MyOtherClass.class);
> > ResourceConfig rc = new ResourceConfig(classes);
> >
> > HttpServer httpServer =
> > GrizzlyHttpServerFactory.createHttpServer(BASE_URI, rc);
> > System.out.println(String.format("Jersey app started with WADL available
> > at " + "%sapplication.wadl", BASE_URI, BASE_URI));
> >
> > and tried to reload like this after replacing the running jar:
> >
> > GrizzlyHttpContainer c =
> (GrizzlyHttpContainer)httpServer.getHttpHandler();
> > c.reload();
> >
> > but no luck, just a ClassCastException. Will that method do what I want
> > and what's the preferred way to get a reference to it?
> >
> > Thanks!
> >
> >
> >
>
>
>
>