[All Adaptavist Apps]
This document explains how to improve performance of menus in Builder 2.x and above...
Based on common scenarios, the following sequence of tuning tips apply to most sites:
hideanon==true
setting of the viewmenu macro and/or editmenu macro. Remember to provide a link somewhere that allows people to log in!In general, the bigger your menus are, the more work Confluence has to do. Likewise, bigger menus create more HTML for users to download and also there's more work for the browser to do when it comes to rendering all that HTML and using JavaScript to draw the menus. Always look for ways to reduce the number of items in your menus, for example rather than having another sub-menu, could you just direct the user to a page with additional navigation links on it?
Using the open source cache macro you can cache any content within Confluence for a specified amount of time. While the content still needs to be downloaded by end-users, the caching reduces the amount of work the server has to do - instead of processing all the wiki notation and macros, it just returns a cached copy of the output.
You need to take in to consideration that the cache macro uses a global cache for all users - if the cached content contains information that's only available to specific users, and the cache is created when those specific users view that content, then other users will see the cached content for those specific users.
Let's use the preferences option on the View menu as an example:
{menuitem}{menuicon:id_card}{menulink:profile}Preferences: %user%{menulink}{menuitem}
Because this macro is processed each time a page is served, it will output different things depending on who is viewing the page:
Now, if you wrapped that item in the cache macro as follows:
{cache}{menuitem}{menuicon:id_card}{menulink:profile}Preferences: %user%{menulink}{menuitem}{cache}
Whoever first views the page, prior to the item being cached, will see the item appropriate to them:
Whatever they see, it will then be cached for up to a day (if there are over 100 separate caches, the oldest caches are deleted to make room for new caches).
So, let's imagine the user who creates the cache is called John. All other users, including anonymous users, would see "Preferences: John" for the next 24 hours or so. That will freak everyone out!
Luckily, this doesn't pose an actual security risk as Confluence will ask them to log in (if they were logged out) or take them to their own preferences page (if they were logged in). However, the fear factor of seeing someone elses' name on the preferences option will frighten most users from using the site.
Likewise, system administrators will freak if they find that the Site Administration link in the Edit menu is being shown to end-users - they'll immediately consider it a security concern and lose confidence in Confluence.
So, while the actual security risk of using the cache macro in menus is very low - assuming you have set-up Confluence's privileges correctly - you should be extremely careful when using it because if used incorrectly people will lose confidence in your wiki.
Adding cache macros in to your menu notation makes it harder to maintain - you might get weird errors or artefacts appearing and not know whether they are related to the cache, the menus or some other aspect of your configuration.
In a future version of Builder we're going to be implementing our own caching mechanism in the various menu macros provided with the theme - this will allow you to cache any menu far more safely because our cache will use different caches for users, etc.
Wherever possible, we encourage you to wait until we add that feature before using any form of caching in the menus.
We strongly discourage the use of the cache macro in the Edit menu because every item needs to thoroughly check the privileges of the user viewing the page.