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.
-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.