English 中文(简体)
How to monitor and maintain my grails application in live/production environment?
原标题:

It is the first time I have ever launched live a website (with Grails web framework under Amazon EC2 platform and Cloud Foundry) and I realized quickly that I am not ready for monitoring and maintening correctly my application in production mode (fortunately the website is accessible to a very limited number of users) .

The issues I have faced so far are:

  • Cannot change my views. I need to redeploy my application
  • I have no monitoring. I don t know who is connected, when do they sign in / sign out...
  • Redploying my application (upload WAR + deploy) takes at least 30 minutes.
  • I don t know how to restart my Tomcat server without a redeploy through Cloud Foundry !
  • ...

So, my question is very simple:

What tools (including grails plugins) and methods can you recommend me for taking me out from my current blindness?

问题回答

I am not sure how much this will help, however I use the JavaMelody Grails Plugin(http://www.grails.org/plugin/grails-melody) I use it to see if the site is being used before I pull down the service.

Hope that helps.

I tried Cloud Foundry in it s early days and found it a little rough. Sounds like that s still the case with 30+ minute deploys and the inability to restart your tomcat server. Half of your problems could be solved if you just created your own EC2 instance, installed tomcat and managed your own deployments. That ll let you bounce tomcat through shell access:

sudo /etc/init.d/tomcat6 restart

and redeploy your app

sudo /etc/init.d/tomcat6/stop
cp my.war /to/tomcat/dir 
sudo /etc/init.d/tomcat6 start

or else you could do it through the tomcat admin console, but I find it to be flaky.

Regarding monitoring, there are a couple of ways you can do that. The easiest is to add CloudWatch monitoring to your system. That ll give you more insight into the performance of the application.

For more detailed monitoring regarding who s connecting to your app, I d suggest looking at Google Analytics or Mint. If you need to get beyond that (with per user monitoring), you ll likely have to roll your own logging/tracking for what meets your needs. There are also other paid packages out there along the lines of Google Analytics and Mint that you can integrate with, but what fits your needs best, I can t say.

For actual monitoring of deployed system you can also use Hiperic HQ. It s a monitoring solution from Spring Source, who also are owners of Grails Framework.

It can manage, at your case:

  1. tomcat server
  2. database
  3. linux
  4. network
  5. etc

btw redeploying app with changes is ok. it s a very bad practice to modify running app, on the production server.

I don t know if JMX and JConsole can help, but that might be a good way to see what the status of JMX-enabled POJOs is. Spring makes this easy to do.

  1. Yes, you need to re-deploy your app when you change stuff in it, there s no way around that.
  2. Deploy/re-deploy time has been cut significantly recently if using the grails plugin (btw, what version of the plugin do you use?) In some cases the upload time is as short as 15 seconds. Add 2-3 minutes for Amazon to spin up the instances and the deploy time is still pretty manageable. For re-deploy the instances don t have to be started, so it s even less than that.
  3. To restart Tomcat login into your CloudFoundry account, click on the Deployment details, click on the instance that s running your Tomcat, and there will be a button "Restart service" that will do just that - restart Tomcat service.
  4. You don t have to start your own EC2 instances in order to get a shell access. Copy the public DNS name of the instance from DeploymentDetails, and SSH into it using the private key you entered when registering for Cloudfoundry. Example:

    ssh -i /path/to/gsg-keypair.pem root@your_instance_DNS_name





相关问题
grails + gwt request handling via controllers

I am new to gwt. I am trying to integrate gwt+grails.Can anybody provide me a good example for handling the request using grails controllers and not a custom servlet.I will be really thankful if ...

Error loading the grails gwt module xml

I ve installed the plugin from this article by Peter http://www.cacoethes.co.uk/blog/groovyandgrails/the-command-pattern-w.... While compile time its not able to find the module file which is present ...

Sorting Objects Based on Custom Domain Class Methods

I have a domain class, in which I ve defined some methods which give the object a score based on different algorithms (eg. popularity). I now want to retrieve a list of these objects sorted by one of ...

Grails Packaging and Naming Conventions

Packaging Controllers, Services,etc. i.e. - com.company.controllers - com.company.services Is this a good practice or should be avoided by all means?? Another worth mentioning problem I encountered ...

Hibernate/GORM: collection was not processed by flush()

I have an integration test in my Grails application that fails when I try to save an entity of type Member invitingMember.save(flush: true) This raises the following exception org.hibernate....

热门标签