This is just a Proof of Concept.
I have a really, really simple app.
It's just one Service, one Job, a few plugins and one jar.
The job runs every 12 seconds and trigger the service.
The service then requests a timeline from twitter, and if there is something interesting (based on key words), it DM that tweet to me.
The plugins: cloud-foundry-1.2.1, cloud-support-1.0.9, plugin-config-0.1.5, quartz2-0.2.2, tomcat-2.0.3
The jar: twitter4j-core-2.2.5 (to access twitter and handle OAuth)
So I don't need a lot of things (database, hibernate, domain, controllers, URLMapping, views, servlets, logging, etc).
The app is currently deployed on cloudfoundry, and running cf-stats, I got:
Memory (limit): 354.8M (512M)
I know that there are free services that can do this for me.
I also know that grails is not the right tool for this job (why choose grails if I won't use most part of it, right? Hell a simple script would do...)
But as I said, this is just a proof of concept...
To the question: Is possible to fine tune a grails-2.0.3 app to run on a memory constrained environment?
Gold achievement: successfully deploy on CF with 64M
Silver achievement: successfully deploy on CF with 128M
Bronze achievement: successfully deploy on CF with 256M
Help, tips, tricks, comments, critics, advises, all of them are welcome.
Thanks and regards.
On Fri, May 11, 2012 at 8:00 AM, omadruga <[hidden email]> wrote:
With just a reliance on a task and a service, you could do all that in a plain spring webapp that wouldn't have nearly the same dependencies that grails does. It is possible that you can tell grails to exclude all of the dependencies that it technically doesn't need for your app, but I have no idea which ones the framework will let you get away with discarding before you start getting class not found exceptions when it tries to load a class just to determine if it needs it. Spring apps have good cloud foundry support, and grails' quartz functionality is straight out of spring, I believe, but you'd have far fewer transitive dependencies by default with a simple spring app, and more control over the app initialization process in order to avoid trying to load a dependency you didn't add to the app. Your actual application code would be mostly unchanged. You'd just have to do a little more work to set up the app manually than you do when you let grails do it for you - but not much. A web.xml that launches a spring application context and an applicationContext.xml that creates two beans or enables annotation scanning for components and scheduled items. I've never been much of a maven user, but I imagine that maven can be made to easily package up a war file for you and such.
I'm not recommending against investigating grails for this use, but from my limited experience with grails, it seems like you have less control over application structure, at least by default, then you do with a raw spring app, and I know that spring can deliver what you want with greatly reduced dependencies compared to a standard grails app, so it may be worth investigating if you don't figure something out in grails.
|Powered by Nabble||Edit this page|