Skip to content
This repository has been archived by the owner on Nov 3, 2017. It is now read-only.

Disable CAS' perf4 facilities

Dmitriy Kopylenko edited this page Aug 29, 2013 · 4 revisions

Version 1.8 introduces the ability to remove perf4j library facilities (if not used) from CAS server by way of modifying CAS server Maven war overlay. These facilities include the perf4j library jar, perf4j log4j appenders included by default in CAS server, and CAS' implementation of AspectJ aspect using perf4j library to time some internal CAS server side code execution paths. To remove those components, follow the following checklist:

Remove perf4 library jar from final CAS war

In pom.xml of your overlay add the following exclude in the maven-war-plugin section:

...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    ...
                    <overlays>
                        <overlay>
                            <groupId>org.jasig.cas</groupId>
                            <artifactId>cas-server-webapp</artifactId>
                            <excludes>
                                ...
                                <exclude>WEB-INF/lib/perf4j-0.9.14-log4jonly.jar</exclude>
                            </excludes>
                        </overlay>
                    </overlays>
                </configuration>
            </plugin>
...

Remove the following perf4j log4j appenders and logger from log4.xml

<appender name="CoalescingStatistics" class="org.perf4j.log4j.AsyncCoalescingStatisticsAppender">
        <param name="TimeSlice" value="60000"/>
        <appender-ref ref="fileAppender"/>
        <appender-ref ref="graphExecutionTimes"/>
        <appender-ref ref="graphExecutionTPS"/>
    </appender>

    <!-- This file appender is used to output aggregated performance statistics -->
    <appender name="fileAppender" class="org.apache.log4j.FileAppender">
        <param name="File" value="/var/log/cas/perfStats.log"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%m%n"/>
        </layout>
    </appender>

       <appender name="graphExecutionTimes" class="org.perf4j.log4j.GraphingStatisticsAppender">
           <!-- Possible GraphTypes are Mean, Min, Max, StdDev, Count and TPS -->
           <param name="GraphType" value="Mean"/>
           <!-- The tags of the timed execution blocks to graph are specified here -->
           <param name="TagNamesToGraph" value="DESTROY_TICKET_GRANTING_TICKET,GRANT_SERVICE_TICKET,GRANT_PROXY_GRANTING_TICKET,VALIDATE_SERVICE_TICKET,CREATE_TICKET_GRANTING_TICKET" />
       </appender>

       <appender name="graphExecutionTPS" class="org.perf4j.log4j.GraphingStatisticsAppender">
           <param name="GraphType" value="TPS" />
           <param name="TagNamesToGraph" value="DESTROY_TICKET_GRANTING_TICKET,GRANT_SERVICE_TICKET,GRANT_PROXY_GRANTING_TICKET,VALIDATE_SERVICE_TICKET,CREATE_TICKET_GRANTING_TICKET" />
       </appender>

    <!-- Loggers -->
    <!--
      The Perf4J logger. Note that org.perf4j.TimingLogger is the value of the
      org.perf4j.StopWatch.DEFAULT_LOGGER_NAME constant. Also, note that
      additivity is set to false, which is usually what is desired - this means
      that timing statements will only be sent to this logger and NOT to
      upstream loggers.
    -->
    <logger name="org.perf4j.TimingLogger" additivity="false">
        <level value="INFO"/>
        <appender-ref ref="CoalescingStatistics"/>
    </logger>

Remove TimingAspect from the final CAS' application context

Add the following bean definition to the application context in your CAS war overlay:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:cas="http://unicon.net/schema/cas"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://unicon.net/schema/cas http://unicon.net/schema/cas/cas-addons.xsd">

    <cas:disable-perf4j-timing-aspect/>

</beans>
Clone this wiki locally