Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Static Caching vs. Partial Caching


Go to End


6 Posts   2636 Views

Avatar
HansR

Community Member, 141 Posts

26 May 2010 at 4:13pm

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

Avatar
HansR

Community Member, 141 Posts

30 May 2010 at 2:45pm

No-one has bothered looking into this?

Avatar
Willr

Forum Moderator, 5523 Posts

30 May 2010 at 5:55pm

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

Avatar
HansR

Community Member, 141 Posts

31 May 2010 at 10:56am

Thanks. I'll probably try out partial caching.

Hans

Avatar
Capt. Morgan

Community Member, 30 Posts

22 June 2010 at 3:44am

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.

Avatar
Willr

Forum Moderator, 5523 Posts

22 June 2010 at 7:46pm

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 :)