Optimization tip: Are your menus and controls cache efficient?
If you are struggling with your apllication consuming too much memory, it may be caused by your menus overusing the cache. Read further to see what you can do about it.
Recently, we have been solving few clients issues regarding their applications consuming too much memory. What was the reason was they didn't properly set up their controls, specifically menus.
In current version the controls usually cache their data using the combination of Current user name (due to security) + current culture + URL + ClientID of the control + some other parameters that may influence the results.
So basically by default each control caches the data per page and if you go to another page, it uses different data. It is like that because in different scenarios you can have the controls parameters based on different factors, so it may vary page from page.
This is not something that would mind for repeater or datalist, because they usually display unique content per each page (listing on parent and detail on child) but the menus display usually the same content on each of the pages, specifically the main menu on master page.
So basically if you do not set your own cache item name, the menu is caching the same data over and over for each page separately which results in high memory consumption, especially in case your documents contain large amounts of data in editable regions from Page tab.
What you should do in case you know your menu doesn't change with each page is to set its property Cache item name
to some specific static unique value
, that would ensure that the same cache item is used for such menu on all pages.
In general, you should always review your project and whereever the controls result in displaying the same data, ensure them shared Cache item name.
Good news is that we have done great job in 5.0 in menu optimization so it will be smarter and pull less data from database (limiting only to what is really needed) even when you do not set the cache item name explicitly.