Caching mechanism

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
3/29/2010 11:44:20 AM
Gravatar
Total Posts 98

Caching mechanism

Hello Joe,

Can you describe in a few words how works the caching mechanism in mojo?

You use this mechanism?

Thanks, Valik

3/29/2010 1:42:27 PM
Gravatar
Total Posts 18439

Re: Caching mechanism

Hi Valik,

Some things are cached, like the SiteMap, SiteSettings or any object that is particularly expensive to create and is used frequently.

Other things are stored in the HttpContext like the current SiteUser if the request is authenticated, this way we only lookup the user or other objects one time per request even if they are needed an various places in code to service the request.

Some features also support output caching like the Html feature for example, but features that use postback or ajax postback to the same page cannot use output cache because it can cause a viewstate error if the cached copy being posted doesn't match the current copy.

However, even though some features like the Html module can support output cache it is disabled by default by this config setting:

<add key="DisableContentCache" value="true" />

you could override that to true from user.config and then you will see in the feature instance settings for the html feature (on the general tab) will be an option for the cache duration.

However, I think you are asking about cache to solve a performance problem since you have been asking other questions about javascript and css as if you thought that is making your site slow. CSS and javascript files are not the cause of a slow site because those files are cached by the browser on the first request and then it does not request them again. You can squeeze a few more requests per second out of a high traffic site by optimizing the javascript and css files but it is like waxing a car to reduce wind resistance, it will not make a car with a low powered engine go faster.

If you click around your site a few times, typically it will be faster because a slow traffic site will be shut down by IIS after 20 minutes of no requests and then it has to be JIT compiled again when it finally gets a request. Once you have clicked around a few times then the site should be considerably faster because all the JIT compiling is up to date. However, if your site is still slow after you have clicked around then the most likely reason is that you have cheap hosting and very little server processor and memory is available to your site. The only solution is to get better hosting.

If you are using any kind of shared hosting or even a dedicated server that does not have lots of RAM, then you should NOT try to use cache because cache uses server memory and that is usually the most precious resource of all. Cache should only be used on a robust server to speed up requests on a high traffic site. In shared hosting you will most likely hurt performance by trying to use cache, because most hosting has IIS configured to recycle your application if it uses a certain threshold of memory. When the app recycles it has to do the JIT compiling all over again and if your application keeps recycling you will have really bad performance. 

Hope it helps,

Joe

3/30/2010 9:38:32 AM
Gravatar
Total Posts 98

Re: Caching mechanism

Thanks Joe for your detailed explanation!

About this setting: "DisableContentCache" . If i set value="false" can caused me problems with website?

3/30/2010 12:59:54 PM
Gravatar
Total Posts 18439

Re: Caching mechanism

Yes, as I said, if you enable caching in a low memory environment it can make performance worse because it will cause the app pool to be recycled frequently.

3/31/2010 1:54:38 AM
Gravatar
Total Posts 98

Re: Caching mechanism

Ok thank you

You must sign in to post in the forums. This thread is closed to new posts.