On Sep 8, 2009, at 7:54 AM, Tom Locke wrote:
> > Hi Folks > > A couple of people have requested the ability to have DRYML taglibs > compiled during app startup, as opposed to the first time they are > used. This has a particular benefit with Passenger, as it allows the > memory used by the taglibs to be shared across the Passenger instances > (required Ruby Enterprise Edition? I'm not sure). > > Anyway, it turned out to be extremely easy, just add lines like this > to an initialiser (e.g. config/initializers/hobo.rb) > > Hobo::Dryml::Taglib.get :src => "taglibs/application" > > If you're on edge, you can do this (just pushed to master): > > Hobo::Dryml.precompile_taglibs > Note that this will cause 'rake hobo:generate_taglibs' to die horribly if you've got app/views/taglibs/auto .gitignored. This line in an initializer will make things play nice: Hobo::Dryml.precompile_taglibs if File.basename($0) != "rake" && Rails.env.production? It also avoids precompiling the taglibs in development and test, as it's not particularly useful there. On my live application, it didn't seem to noticeably reduce memory usage (on REE); BUT it did make starting up new worker instances considerably faster (under load, several would try to start at once and all be compiling the same sources). That makes it easier to just keep the workers recycling every hour or so and helps the memory usage issues. --Matt Jones > Which will find all .dryml files in your main taglibs directory and > any plugins, and precompile them all. > > I'd be very interested to hear from anyone about improvements to > memory consumption as a result of this trick (Matt!) > > Cheers > > Tom > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
