+1-888-365-2779
Try Now
More in this section

Forums / Deployment / Curious About Caching

Curious About Caching

16 posts, 0 answered
  1. Josef Rogovsky
    Josef Rogovsky avatar
    39 posts
    Registered:
    04 Sep 2012
    05 Sep 2007
    Link to this post
    I notice that in Page Properties->More Options there is an item called "Cache this page(?)".

    I'm curious what the implications of setting this to "Yes" would be.

    What kind of speed improvement should we expect with this? How often is the cache refreshed, etc.
  2. Bob
    Bob avatar
    330 posts
    Registered:
    24 Sep 2012
    05 Sep 2007
    Link to this post
    Hi Josef,

    The implications could be enormous. When this option is selected the rendered output of the page is cached in memory or database depending on what cache mode is set. When the page is requested again instead of creating new instance of the page and all controls the rendered HTML is retrieved from the cache and written directly to the output stream. In other words no additional database calls are made, no control instances, no events are fired. The response time to serve cached page is just as serving static .html file.

    The output cache is cleared when a page is published. That means all changes to a cached page will take place immediately.

    Sitefinity 3.0 supports InMemory and InDatabase cache modes. InDatabase mode will perform slightly slower but it is useful for large sites and limited RAM. Sitefinity 3.1 also supports standard ASP.Net caching. To use the standard caching you have to set caching attribute for telerik/cms element in web.config to AspNet. The default value for the attribute is InMemory.

    Note version 3.0 does not support Substitution control. Version 3.1 supports Substitution control only for AspNet mode. For version 3.2 we will support Substitution control for the other two modes as well.

    Kind regards,
    Bob
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Brook
    Brook avatar
    39 posts
    Registered:
    21 Mar 2007
    05 Mar 2008
    Link to this post
    Josef is the caching setting your reference as

    'To use the standard caching you have to set caching attribute for telerik/cms element in web.config to AspNet.'
     
    supposed to be InDatabase? versus AspNet ?

    I only found one entry for this in the config file in the <telerik> section is that the right section?
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    05 Mar 2008
    Link to this post
    Hello Brook,

    This is the right section. If you would like to use standart Asp.Net caching technique, your code should look like this :
    <telerik> 
    <cms defaultProvider="Sitefinity"  
         pageExtension=".aspx"  
         projectName="modules" 
         disabled="false"  
         pageEditorUIMode="Overlay"  
         caching="AspNet"
    </telerik> 

    Let us know if we can assist you with anything else.

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Richard Baugh
    Richard Baugh avatar
    201 posts
    Registered:
    22 Aug 2012
    07 Mar 2008
    Link to this post
    I am also a little interested in the caching inside Sitefinity. I understand that a page is either cached in Memory or the DB, but what I am a little unclear on is when is it released/cleared? I noticed that you stated that when a page is published, the cache will be cleared. Does this only affect the current page or all pages set as cached?

    What I am getting at is that if you add a page to the site and you have cached pages, the navigation will not be updated unless all cached pages are cleared.
  6. Vlad
    Vlad avatar
    498 posts
    Registered:
    15 Jul 2016
    10 Mar 2008
    Link to this post
    Hi Richard,

    All pages cache is cleared when you add, delete or update a page. So the navigation will also updated.

    Sincerely yours,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Mat
    Mat avatar
    23 posts
    Registered:
    05 Nov 2006
    03 Apr 2008
    Link to this post
    Hi,

    After reading this thread I've got the impression that Sitefinity 3.2 will support the Substitution control.

    It seems that is not the case. Does Sitefinity supports the substitution control in Version 3.2?

    Greetings,
    Mat
  8. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    08 Apr 2008
    Link to this post
    Hello Mat,

    We still don't support the substitution control with our implementation of caching. You can still build your own custom controls with substitution, but you should use the standard AspNet caching in this case.

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    07 Aug 2008
    Link to this post
    I'm wanting to enable caching to improve perfomance of my site as well, but I'm still a bit confused  as to the best way to proceed...

    First, i'm not sure what mode to use, as I'm confused about the differences between the options. My understanding is that AspNet is the built in asp.net 2.0 caching mode, and that it will cache all pages in memory, and refresh them only after either the time expires or the application restarts is that right?

    clearly I would want a method that will consider changes to a page to expire the cache, and if i'm not mistaken, that would be the InMemory method, which is sitefinity's own implementation of caching. Is that right? this method would invalidate the FULL cache anytime a change is made by publishing either a page or content item (such as news, blogs etc).

    Finally there's database, which I'm understanding is exactly the same as inmemory, except it stores the cache in a database table instead of memory.

    Do I have all that right so far? If not, please correct me so I can have a better understanding of where to go next. Now that being said, can you also clarify these followup questions:

    Do the separate cache methods cache a separate instance of the page for each individual visitor to the site, or does it instead cache one copy from which ALL visitors receive the pages? If it's the latter, how do you handle if pages render differently for differnt types of users or at different times of the day?

    does the Database caching mode require a separate database that needs to be configured or does the sitefinity already have a table for this?

    Finally, what about changes made outside of the publish tool? I have a lot of user controls that I place in various pages, so when I need to make changes, I don't go into the page editor, I edit the actual control itself, then upload it. since I'm bypassing the publish event, how would the cache be invalidated and refreshed?

    thank you for taking the time to review and respond to these inquiries!
  10. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    11 Aug 2008
    Link to this post
    Hi SelArom,

    I believe that the KB article Optimizing Performance on Sitefinity Web Site will answer all of your questions precisely.

    Do let us know if you have any other questions.

    Best wishes,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  11. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    11 Aug 2008
    Link to this post
    thanks for your reply but I had just read that when I posted this. I get the basic idea and implementation from the article, but the specific questions I had were a little unclear, especially with respect to invalidating the cache without using the publish button. like I said I have some controls that I change by uploading and overwriting, bypassing edit and publish of the page.
  12. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    13 Aug 2008
    Link to this post
    Hello SelArom,

    We learnt from our US office that you called them about a problem with your site performance. We will try to give you some tips here, but let me first answer your questions from your previous post.

    Invalidating the cache without using the publish button. like I said I have some controls that I change by uploading and overwriting, bypassing edit and publish of the page.
    The cache is indeed invalidated when you publish new page. Having that said, if you modify a control which is used in some of your pages but is modified outside Sitefinity administration, then the changes will not be reflected until the cache is refreshed. You could clear the cache with this code:
    Telerik.DataAccess.CacheDependencyHandler.Current.Notify(typeof(Telerik.Cms.ICmsPage));  
    It should be run in the context of the application. This way, whenever you change a control, you could clear the cache. There are more approaches, as mentioned in the provided KB Article - Using Substitution control and the standard ASP.NET caching, you could cache everything on the page except your control.

    Do the separate cache methods cache a separate instance of the page for each individual visitor to the site, or does it instead cache one copy from which ALL visitors receive the pages? If it's the latter, how do you handle if pages render differently for differnt types of users or at different times of the day?
    It caches one copy of the page and serves it to all users. If you want to show  dynamic data to every single user, then you should not cache the page, or you should use ASP.NET caching with Substitution control.

    does the Database caching mode require a separate database that needs to be configured or does the sitefinity already have a table for this?

    It is not necessary to specify an additional database when using InDatabase cache and cacheDependancy, Sitefinity could use its own database. Declaring additional database in an option, but not a must.

    We have inspected your web site and here is what we noticed:
    1. The first time when we open the web site, the home page is rendered for about 3 seconds. The rest of time (nearly 50 seconds) is taken for loading the resource files. We noticed that there were 5 images, each is about 300K which results 1,5MB. This is making your website heavy. The total size of the home page on first load is 3,3MB. Please review the attached screenshots (initial1 and initial2 images).

    2. On the second load, the downloaded amount of data from the home page went down to 350K, but there are still uncached CSS files and Javascripts slowing down the page load. We suggest you installing HttpWatch addon to Internet Explorer and check these scripts and style definitions. The page itself is rendered for again 3 or 4 seconds.

    You should probably consider optimizing the images and scripts used in your page.

    Kind regards,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  13. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    14 Aug 2008
    Link to this post
    thank you for your very helpful reply. actually I didn't call anybody, someone contacted me from your company about improving performance, it was kind of weird, but I'm glad it turned out to be helpful.

    we will definitely look into caching and optimizing our scripts and images, as well as caching. thank you for taking the time to provide a detailed response to my questions.
  14. Josef Rogovsky
    Josef Rogovsky avatar
    39 posts
    Registered:
    04 Sep 2012
    14 Aug 2008
    Link to this post
    Now that's what I call personal service!

    Telerik should feel free to call me anytime. ;)
  15. Gabe Sumner
    Gabe Sumner avatar
    440 posts
    Registered:
    09 Sep 2007
    18 Aug 2008
    Link to this post
    This is a great thread and it helped me a lot!

    I was running into a "stale cache" issue relating to blog comments.  Each time a new comment was posted to my blog, the old-version of the web page continued to be displayed.

    As a work-around, I created a small UserControl that I placed on the Blog ControlTemplate.  This UserControl checks for a PostBack.  If "IsPostBack" is "true" then we assume a new comment has been posted and expire the current cache.

    I wrote a bit more about this at the following URL:

    http://www.goondocks.com/blog/08-08-18/Sitefinity_Refreshing_the_Cache.aspx


    Gabe Sumner
    http://www.goondocks.com/
  16. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    18 Aug 2008
    Link to this post
    Hi Gabe Sumner,

    Thank you for sharing your approach with us. I am sure that your feedback will be very helpful to other community members.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
16 posts, 0 answered