Forum: Ruby on Rails In Rails 4, how to achieve Edge Side Include and HTTP Cache Reverse Proxy behavior?

7a7145a8552f54c044da97750f5889e2?d=identicon&s=25 Ardian Yuli Setyanto (Guest)
on 2014-04-03 11:22
(Received via mailing list)
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.htm...
> {{ 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.htm...
> 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.
F50d3b02eee623a2172b58c09fe31c2c?d=identicon&s=25 mike2r (Guest)
on 2014-04-04 18:10
(Received via mailing list)
On Thursday, April 3, 2014 2:36:32 AM UTC-4, Ardian Yuli Setyanto wrote:
>
>> Symfony2 comes with a reverse proxy (also called a gateway cache) written
> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.