Jump to:

23454 Posts in 18904 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Static Caching vs. Partial Caching

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2036 Views
  • HansR
    Avatar
    Community Member
    140 Posts

    Static Caching vs. Partial Caching Link to this post

    I was about to ask about the possibility of caching pages that are predominantly static, but have one or two dynamic bits to them. Then I noticed that Silverstripe 2.4 already has this feature. What is the performance difference between fully static caching and partial caching? Obviously static caching will be fastest, but it would be interesting/helpful to see some benchmarks that compare fully dynamic, partial caching and static caching.

    Also, is it possible to disable static caching for specific page types by adding the caching methods (e.g., allPagesToCache() to that page type's class? Or does it all have to be handled by the master Page class?

    Hans

  • HansR
    Avatar
    Community Member
    140 Posts

    Re: Static Caching vs. Partial Caching Link to this post

    No-one has bothered looking into this?

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Static Caching vs. Partial Caching Link to this post

    Hi HansR,

    We don't have any official benchmarks to help you decide but I would recommend going with partial caching if you have areas which update dynamically. Partial caching is much much more flexible and reliable. I've used static caching on a couple sites and it is appropriate for a site thats designed in a specific way you can get a few quirks especially around pages with interactive elements, displaying comment counts etc.

    As you said the static caching would get the best performance. Its only really limited to your servers ability so you can serve massive amounts of html without any issues.

    I did a quick Partial Test vs raw SS vs static using apache bench over 1000 requests. (I'm not a benchmarking expert FYI)

    For the sake of the test I did a checkout of branches/2.4. Installed on a new mysql DB. No extra modules. My environment is a 2.4ghz Macbook Pro, 3GB of RAM running Macports. PHP 5.3.2 and Apache/2.2.15.

    I used ab -n 1000 http://localhost/silverstripe-core/2.4 for each test

    2.4 default non partial cached over 1000 requests:
    Requests per second: 710.87 [#/sec] (mean)
    Time per request: 1.407 [ms] (mean)

    2.4 default partial cached over 1000 requests
    Requests per second: 797.28 [#/sec] (mean)
    Time per request: 1.254 [ms] (mean)

    2.4 default static cached over 1000 requests
    Requests per second: 958.14 [#/sec] (mean)
    Time per request: 1.044 [ms] (mean)

    Hope that helps .

  • HansR
    Avatar
    Community Member
    140 Posts

    Re: Static Caching vs. Partial Caching Link to this post

    Thanks. I'll probably try out partial caching.

    Hans

  • Capt. Morgan
    Avatar
    Community Member
    30 Posts

    Re: Static Caching vs. Partial Caching Link to this post

    I just made a very (VERY!) unscientific test to see how much improvement I can get with partial cache. I have a pagetype where I cached breadcrumbs, menus, a widget area and some listings. The load time went from an average on ~2.00 sec down to ~0.70.
    The result was what I expected, but I am very impressed with how easy partial cache is to use.

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Static Caching vs. Partial Caching Link to this post

    Glad your impressed Capt. Morgan! As 2.4 becomes stock standard you'll start to see all the modules using it. Partial caching should be something people do by default. Its simple enough to setup and faster sites are better sites

    2036 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.