Ruby on Rails Friday, April 4, 2014



On Thursday, April 3, 2014 2:36:32 AM UTC-4, Ardian Yuli Setyanto wrote:
I'm from Symfony2 PHP and currently migrating to Rails 4, I have no knowledge with Rails 3 and before. I'm working on my web project with one last todo list to enable dynamic caching in this rails 4. In Symfony2 there are built in function to setup Edge Side Include behavior effortless. Some of this functionality :

  • Sf2 have templating function to insert esi include tag <esi:include src="http://..." /> with router name as parameter
http://symfony.com/doc/current/book/http_cache.html#using-edge-side-includes
{{ render_esi(url('latest_news', { 'max': 5 })) }}

  • Sf2 have built in reverse proxy gateway to merge cached page which have esi tag with corresponding response from each included esi tag url.
http://symfony.com/doc/current/book/http_cache.html#edge-side-includes 
Symfony2 comes with a reverse proxy (also called a gateway cache) written in PHP. Enable it and cacheable responses from your application will start to be cached right away. Installing it is just as easy. Each new Symfony2 application comes with a pre-configured caching kernel (AppCache) that wraps the default one (AppKernel). The caching Kernel is the reverse proxy.

I have learning page, action, fragment cache. I also found Rack::ESI. I know there are middleware idiom, but I don't know what it's. I still have no idea how to setup all this info correctly. My esi tag doesn't replaced with corresponding response from esi tag url like in Sf2. I think this is because I haven't configured reverse proxy middleware in my Rails. So my question is, in Rails 4, how to achieve Edge Side Include and HTTP Cache Reverse Proxy behavior ?

Regards.


Generally, ESI isn't used in Rails since the inclusion of Russian Doll caching which is generally more effective (at least I haven't seen it much, maybe it is).  You can use ESI using the middleware you've already found, but I believe you have to establish your own gateway-cache using Mongrel-ESI or Varnish.  I'm not positive on this, but you would have to research it.

Personally, I would look at Russion Doll caching.  Also, if your application does a lot of authentication/authorization, I would look at low level caching as caching the user table can really speed things up in applications that are authentication/authorization intensive. 

@mike2r

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ba4ca87c-1f07-49d1-b92c-6e95c5ee2009%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment