I wonder if this could work. I'll check further this evening ...

    render_class=Class.new(Dryml::TemplateEnvironment)
    template=Dryml::Template.new("",render_class,"")
    template.compile([],[Dryml::CORE_TAGLIB]+ [{:src =>
"taglibs/front_site"}] + [{:src => "taglibs/admin_site"}])

2012/11/17 Arnaud Doyen <[email protected]>

> Hi all,
>
> I have been using Unicorn in production with my fresh new site.
> This is working quite well but at the first load of each worker, it's
> quite slow.
>
> In fact, I see the precompilation of all dryml's in production.log, like
> this:
>   [...]
>   DRYML: Compiled
> /home/rails/ifapevent/shared/bundle/ruby/1.9.1/gems/hobo_bootstrap-2.0.0.pre3/taglibs/show_page.dryml
> in 0.01s
>   DRYML: Compiled
> /home/rails/ifapevent/shared/bundle/ruby/1.9.1/gems/hobo_bootstrap-2.0.0.pre3/taglibs/table-plus.dryml
> in 0.01s
>   DRYML: Compiled
> /home/rails/ifapevent/shared/bundle/ruby/1.9.1/gems/hobo_bootstrap-2.0.0.pre3/taglibs/tabs.dryml
> in 0.01s
>   DRYML: Compiled
> /home/rails/ifapevent/shared/bundle/ruby/1.9.1/gems/hobo_bootstrap-2.0.0.pre3/taglibs/hobo_bootstrap.dryml
> in 0.41s
>   DRYML: Compiled app/views/taglibs/auto/rapid/cards.dryml in 0.08s
>   DRYML: Compiled app/views/taglibs/auto/rapid/pages.dryml in 1.16s
>   DRYML: Compiled app/views/taglibs/auto/rapid/forms.dryml in 0.26s
>   DRYML: Compiled app/views/taglibs/application.dryml in 0.42s
>   DRYML: Compiled app/views/taglibs/front_site.dryml in 3.90s
>   DRYML: Compiled app/views/ads/index.dryml in 4.06s
>   Rendered ads/index.dryml (5237.4ms)
> Completed 200 OK in 5337ms (Views: 5326.6ms | ActiveRecord: 4.3ms |
> Sphinx: 0.0ms)
>
> Then, I wonder if it could be possible that, after_fork, is there a way to
> precompile these dryml directly and not when a user ask for a page.
> By doing that, I can have normal rendering times like this (second call of
> a worker) :
> Processing by AdsController#index as */*
>   Parameters: {"search"=>"#254"}
>   Rendered ads/index.dryml (64.2ms)
> Completed 200 OK in 69ms (Views: 64.2ms | ActiveRecord: 1.2ms | Sphinx:
> 0.0ms)
>
> Is there something I can call in the after_fork section of unicorn
> configuration ?
>
> after_fork do |server, worker|
>     ActiveRecord::Base.establish_connection
>     ActiveRecord::Base.verify_active_connections!
>     #Hobo.preload_taglibs ?
> end
>
>
> I'll look also for that, since I have some ideas while writing this email
> :-)
>
> Thanks,
> Arnaud.
>

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

Reply via email to