简体   繁体   中英

Fragment caching vs page caching

I'm wondering how fragment caching stands up against page caching. Obviously caching the entire page will be much faster since it could be served up by the web server without involving rails, but how much slower is fragment caching?

Lets say for example that I have a shopping cart application, and in the header it needs to display the number of items in your cart.

I could cache the whole page and use JS and cookies to make the header appear dynamic, or I could fragment cache everything other than the header.

Right now with full page caching my load benchmarks show around 70ms per request at around 7000 requests per minute.

I know there's no absolutes in this, but could someone guestimate what type of hit I would take with a fragment cache approach?

Thanks

Personally, I use fragment caching, for the exact reason you mentioned. Dynamic user-specific content.

I use Memcached for server-side data and Cloud Front for static assets.

All of my API calls are cached and give me that sub 100ms response, the HTML on the page could be sent with GZip.

Things get complicated with sessions and cookies. Especially when the server needs to read those cookies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM