Amazon EC2, autoscaling and Glassfish challenges

Posted by – July 9, 2011

Are you thinking about put a awesome java webapplication running on top of Glassfish application server and use the awersome Amazon Elastic Balancer? If the answer is yes, please read this article first.

At first time the autoscaling feature seens to be an awesome solution, but it may bring some problems if the website deployment isn’t properly planned.

The first and the biggest issue that I found is website update, I created a simple script that check if there’s a new version of site war file at Amazon S3 and then perform its download, if I just redeploy the war file it may crash because of the current database connections made by JPA which cause to put all website down.

I decided to make a small change, where everytime when I have a update the application service is stopped and started before war file redeployment, it also give me few issues because of elastic balanced perfoming health checks.

And wait, there’s another issue, if your website redeployment takes too much to be successful the Amazon EC2 instance will be terminated and may put the entire solution even more unstable.

Here’s a fe tips to make your experience with autoscaling even more better:

* Perform a application server health check by placing static files at the root of your application context, like a simple text file
* Stop the apache and perform the application server restart
* Perform war file redeployment
* Start apache
* Adjust load balancer unhealthy and healthy threshold properly

I believe that you may be very successful if consider these tips.

Good luck!


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>