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==truesetting of the viewmenu macro and/or editmenu macro. Remember to provide a link somewhere that allows people to log in!
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:
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:
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.
The view menu has several areas that can be cached and we've provided an example below based on the current structure of the view menu at the time of writing this article.
By caching the "Other Pages" menu, which contains links that are generally available to anyone who can view the space, we've cached the output of 34 macros. Even though those macros don't do much, they still take time to process and when you think of how many times a page is viewed in a single day it's obvious that this will improve performance of your site.
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.