Quantcast
Channel: CardinalCore » Don’t Fight The Framework
Viewing all articles
Browse latest Browse all 10

Don’t Fight The Framework – Further down the rabbit hole optimising Sitecore MVC Performance.

0
0

I figured I had put this little mini-series too bed with my posts on Strategies to optimise Sitecore MVC performance and Further strategies to optimise MVC performance, it seems not.

I was recently looking into the effect of the @Html.Sitecore().Controller(“”) @Html.Sitecore().Rendering(“{id}”) on the performance of a Sitecore MVC based solution. Here is what I found:

@Html.Sitecore().Controller(“”)

This does exactly what it says on the tin, it indeed calls a controller (NOT controller rendering) from within your codebase. This is fine and dandy if that is what you want to do, but do bear in mind, it has no caching options available, so you need to implement your cache manually in your controller.

@Html.Sitecore().Rendering(“{id}”)

This on the other hand doesn’t. I expected this method to call my rendering (similar to sc:Sublayout in Sitecore webforms) and respect the caching settings set on the rendering item defined at {id}. In short – it doesn’t, it appears right now (tested and confirmed on Sitecore 7.2 and 7.5) to ignore your caching settings and simply call the controller / view rendering every time. This of course can have a negative impact on performance in your solution.

Conclusion

I guess as is the case with all of these things, don’t assume. I have been seriously considering running a series about performance optimisation techniques on here, but the biggest key is that we as developers should aim to have a performance testing & enhancement sprint regularly within our projects.

A support ticket has gone in at this time to ascertain whether this is desired behaviour (it doesn’t seem to be to me) and if not, will hopefully result in a patch from the amazing guys in Sitecore support. I believe it would also be neat to extend the api so we could set the cache settings in code?, but that’s a battle for another day.



Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images