I’m developing a fork of the Heroku buildpack for JRuby that uses JDK7 and JRuby 1.7.0.preview1. The good news is that it works – the bad news is that the slug is very large. Once I bundle together JRuby, the JDK, and a “Hello, world” Rails 3 app, the compressed slug size is 98.4 MB at deploy time. This isn’t surprising, given that the JDK is 129 MB and JRuby is 29 MB (both uncompressed).
Since Heroku has a limit of 100MB for the slug, this leaves me with very little room for actual application development – it’s easy to see that even a simple Rails app will push me over the limit.
I’ve already removed as many obviously “optional” things from both the JDK and JRuby as possible (source code, docs, examples, native libraries for things other than x86_64, etc). I’m wondering if there’s any clever way to move things out of the slug, reduce the JDK or JRuby much further, or actually increase the allowed slug size. Given Heroku’s buildpack support and the de facto practice of bundling VMs and frameworks in slugs, the 100MB limit is a much lower ceiling than it used to be.
It’s not really my area, but I think you could go through the JDK JARs and remove a fair amount of stuff that doesn’t make sense to have on the server. I know you removed some files, but it doesn’t sound like you pruned any of the JARs that you kept. I just took a peak and saw a bunch of Swing and AWT classes, for example. Those alone should buy you several megabytes. I’m sure you’d know better than I what else would be good candidates for removal.
Update: I was curious, so I just gave it a try. I saved 5.5MB by removing Swing and AWT. That seems like a solid start, and again, presumably someone with more familiarity will likely have a good idea what else might make sense to remove.
Update 2: And I just saved another 4.5MB, for a total of 10MB, by using
bzip2 --bestto recompress the (decompressed) java archive. That trick only saved half a meg for the jruby archive, but that still brings the total to 10.5MB smaller.