这个页面告诉你如何启用页面请求属性。当这个属性启用以后,你可以查看在 Confluence 任何页面完成的一个记录消耗的时间(毫秒)。如果 Confluence 反应缓慢的话,一个关于慢页面请求的内部请求时间来帮助你识别在页面中是哪些资源导致的页面载入缓慢。

你需要访问 Confluence 服务器来查看一个属性。

启用页面请求属性

如果只希望查看慢性能宏,请参考 Identifying Slow Performing Macros 页面中的内容。


(info) 你需要具有系统管理员权限才能启用和禁用属性。

希望启用页面属性:

  1. 在屏幕的右上角单击 控制台按钮cog%20%281%29.png?version=1&modificationDate=1530107797000&api=v2 ,然后选择 General Configuration 链接。

  2. 在左侧的面板中选择 日志和属性(Logging and Profiling)

  3. 在显示的 日志和属性(Logging and Profiling)界面中。选择 启用属性(Enable Profiling)
    (info) 如属性已经被启用了,那么这个按钮将会被标记为 禁用属性(Disable Profiling)。

希望禁用页面属性:

  1. 在屏幕的右上角单击 控制台按钮cog%20%281%29.png?version=1&modificationDate=1530107797000&api=v2 ,然后选择 General Configuration 链接。

    1. 在左侧的面板中选择 日志和属性(Logging and Profiling)

  2. 在显示的 日志和属性(Logging and Profiling)界面中。选择 禁用属性(Disable Profiling)
    (info) 如属性已经被禁用了,那么这个按钮将会被标记为 启用属性(Enable Profiling)。

屏幕截图:修改日志级别和属性

Admin_logging_profiling.png?version=1&modificationDate=1537400028113&api=v2

属性的一个活动

  1. 为了启用属性,使用上面描述的方法。
    针对所有的用户,属性每一个访问的页面,将会在你的应用服务器中进行记录,直到你对 Confluence 进行重启。请注意每次用户访问一个链接,一个单一的属性将会被打印出来。

  2. 确定属性已经被写入到 Confluence 的日志文件中 —— 请参考 Working with Confluence Logs 页面中的内容,来对写入的日志文件和细节进行定位。

  3. 对不正常的访问缓慢确定这个问题出现的时间。

  4. 拷贝属性中的操作。为了确定哪些属性日志需要进行拷贝的时候,查找相应时间过长的链接。如果一个单一页面访问缓慢的话,那么只有这个页面的属性日志是需要的。如果 Confluence 表现的是间歇性访问缓慢或者整体访问缓慢的话,拷贝所有属性日志文件,直到对可能的访问日志完全包含。

  5. 如果 Atlassian  技术支持小组需要你对你的系统进行属性日志进行提交,你可以将你的属性日志全部提交给 Atlassian  支持小组。

  6. 使用上面提供的方法,关闭你的属性日志收集。

  7. 确定你的属性日志不再打印到 Confluence 的日志文件中了。

属性的一个示例

下面是有关 Confluence 页面被调用的前几行的访问概述。

[344ms] - /display/ds/Confluence+Overview
  [313ms] - SiteMesh: parsePage: http://localhost:8080/display/ds/Confluence+Overview
    [313ms] - XW Interceptor: Before defaultStack: /pages/viewpage.action (ViewPageAction.execute())
      [0ms] - SpaceAwareInterceptor.intercept()
      [16ms] - PageAwareInterceptor.intercept()
        [0ms] - AOP: PageManager.getPage()
        [16ms] - AOP: PermissionManager.hasPermission()
          [0ms] - AOP: SpacePermissionManager.hasPermission()
          [16ms] - AOP: SpacePermissionManager.hasPermission()
        [0ms] - AOP: SpacePermissionManager.hasPermission()
      [0ms] - AOP: SpacePermissionManager.hasPermission()
      [281ms] - XW Interceptor: After defaultStack: /pages/viewpage.action (ViewPageAction.execute())
        [281ms] - XW Interceptor: After validatingStack: /pages/viewpage.action (ViewPageAction.execute())
           ...

(info) 注意,每一个缩进的行表示的是上一个调用下面的子调用。上面的示例中,Confluence Overview 页面调用完成耗费了 344ms。在这个 344ms 中,313ms 消耗在了 sitemesh 上。

在启用属性的情况下启动 Confluence

在一些情况下,你可以希望 Confluence 在系统启动的时候就对属性文件进行打印。如果你的 Confluence 经常进行重启,并且你可能忘记来启动针对系统诊断的属性文件日志开关。

编辑 CONFLUENCE_HOME\confluence\WEB-INF\web.xml 文件。你应该可以在文件中看到与下面输出内容类似的行。设置 autostart 参数为 true:

     <filter>
        <filter-name>profiling</filter-name>
        <filter-class>com.atlassian.confluence.util.profiling.ConfluenceProfilingFilter</filter-class>
        <init-param>
            <!-- specify the which HTTP parameter to use to turn the filter on or off -->
            <!-- if not specified - defaults to "profile.filter" -->
            <param-name>activate.param</param-name>
            <param-value>profile</param-value>
        </init-param>
        <init-param>
            <!-- specify the whether to start the filter automatically -->
            <!-- if not specified - defaults to "true" -->
            <param-name>autostart</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>

如果你希望 Confluence 在重启的时候不记录属性日志或者你的属性日志过大的话,你可以将这个参数重新设置为  false 。


https://www.cwiki.us/display/CONF6ZH/Troubleshooting+Slow+Performance+Using+Page+Request+Profiling