Re:Introducing Play 2.0
by jshen on Wednesday September 07, 2011 @10:25AM
(#2969584)
My biggest problem with jvm web stuff is that it uses so much ram for simple little web apps. For someone that likes to make small web apps for fun, I can't fit more than one jvm app on my little vps. Anyone know how to get the memory down on these things?
[ Parent
| on HN ]
My answer, and no it's probably not what you want to hear, is one of two things:
-Get a bigger VPS
-Build bigger applications.
There is a lot of overhead in the JVM (CLR too). It's pretty much unavoidable in the Java ecosystem. That said, that overhead remains relatively constant even as you write significantly bigger pieces of software, so after a certain point it tends to matter a lot less.
Just to re-inforce this: While the initial memory spike can seem pretty unreasonable coming from a site with a couple Mongrels or something, converting to JRuby from a Unicorn site using 16 workers and over 2GB of RAM is very nice. You end up using a lot less RAM and support a lot more connections.
yeah, it's definitely great once you reach a certain traffic level. I imagine you either get a ton of traffic, or you're site is very dynamic to require 16 workers. I cache a lot of pages so many requests do not hit the rails stack at all.
But this is what I love about the ruby world, we get both options :)
I've opted for the third option, use C ruby. I use JRuby at work and love the JVM in that context, I just wish I could use it for my fun side projects :(
PS - using ruby and having both options is pretty awesome.
You can set the minimum and maximum heap size using -Xms and -Xmx, e.g. -Xmx512M will limit the heap to 512 MB.
yeah, but I can't get it to run below 100mb for the whole process. heap is around 30mb, perm gen around 25mb, then another 50 somewhere.
heroku has support for play, though it's not 2.0 yet. a free account might be a good workaround to your vps.
heroku is far more expensive if you have any amount of data, or if you need a background worker. I run 3 rails sites, with background jobs, a search engine (sphinx), etc. All on a $30/month vps, and they run great.