Runtime performance monitoring made easy

Aggregation Persistence

By default all aggregated performance details are kept in memory only. If you want to have your results surviving VM restarts you need to alter the aggregation chain and use a persistent aggregator. Persistent aggregators are backed by a PersistenceBackend. The default implementation is a FileSystemPersistenceBackend that may be replaced with your own implementation.

Persistent Aggregators in jetm-config.xml (used by EtmManager)

Enabling persitence in a jetm-config.xml is pretty simple - see examples below.

Enable feature persistence (JETM 1.2 configuration):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jetm-config PUBLIC "-// void.fm //DTD JETM Config 1.2//EN"
                             "http://jetm.void.fm/dtd/jetm_config_1_2.dtd">
<jetm-config>
  <features>
    <persistence/>
  </features>
</jetm-config>

Switch to PersistentRootAggregator (JETM 1.0 configuration):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jetm-config PUBLIC "-// void.fm //DTD JETM Config 1.0//EN"
                             "http://jetm.void.fm/dtd/jetm_config_1_0.dtd">
<jetm-config>
  <aggregator-chain>
    <chain-root>
      <aggregator-class>
        etm.core.aggregation.persistence.PersistentRootAggregator
      </aggregator-class>
    </chain-root>
  </aggregator-chain>
</jetm-config>

Persistent Aggregators in Spring

Similar to jetm-config.xml spring managed JETM instances can use persistence also. Depending on your Spring runtime persistence configuration slightly differs. Use one of the xml fragments below.

Enable file based persistence for a Springframework 2.x managed JETM runtime:

<?xml version="1.0" encoding="UTF-8"?>
<beans ...>

  ...

  <jetm:runtime>
    <jetm:features>
      ...
      <jetm:persistence />
    </jetm:features>
  </jetm:runtime>

</beans>

Enable file based persistence for a Springframework 1.x managed JETM runtime:

<?xml version="1.0" encoding="UTF-8"?>
<beans ...>

  <bean id="etmMonitor"
      class="etm.core.monitor.NestedMonitor"
      init-method="start" destroy-method="stop"
      autowire="constructor"/>

  <bean id="aggregatorChain"
        class="etm.core.aggregation.persistence.PersistentRootAggregator" />

</beans>

Backend configuration

As stated above file based persistence will be used by default. It will read serialized aggregation results from a file during startup and store the current state at shutdown. The default configuration will use a file called jetm-state.ser in the system java.io.tmpdir. Of course it is possible to alter both the directory and filename.

Alter persistent filename in jetm-config.xml, file will be saved in java.io.tmpdir (JETM 1.2 config):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jetm-config PUBLIC "-// void.fm //DTD JETM Config 1.2//EN"
                             "http://jetm.void.fm/dtd/jetm_config_1_2.dtd">
<jetm-config>
  <features>
    <persistence>
      <file-backend filename="application-state.ser"/>
    </persistence>
  </features>
</jetm-config>

Alter persistent filename in jetm-config.xml, file will be saved in java.io.tmpdir (JETM 1.0 config):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jetm-config PUBLIC "-// void.fm //DTD JETM Config 1.0//EN"
                             "http://jetm.void.fm/dtd/jetm_config_1_0.dtd">
<jetm-config>
  <aggregator-chain>
    <chain-root>
      <aggregator-class>
        etm.core.aggregation.persistence.PersistentRootAggregator
      </aggregator-class>
      <properties>
        <!-- <property name="backendProperties.path">/foo/bar</property> -->
        <property name="backendProperties.filename">application-state.ser</property>
      </properties>
    </chain-root>
  </aggregator-chain>
</jetm-config>

Alter persistent path in a spring 2.x configuration, state will be persisted in /opt/application/state/jetm-state.ser:

<?xml version="1.0" encoding="UTF-8"?>
<beans ...>

  ...

  <jetm:runtime>
    <jetm:features>
      <jetm:persistence>
        <jetm:file-backend path="/opt/application/state" />
      </jetm:persistence>
    </jetm:features>
  </jetm:runtime>

</beans>

If you want to use a custom PersistenceBackend supply a valid implementation to PersistentRootAggregator. See examples below for EtmManager and Spring managed JETM instances.

A custom PersistenceBackend in jetm-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jetm-config PUBLIC "-// void.fm //DTD JETM Config 1.0//EN"
                             "http://jetm.void.fm/dtd/jetm_config_1_0.dtd">
<jetm-config>
  <aggregator-chain>
    <chain-root>
      <aggregator-class>
        etm.core.aggregation.persistence.PersistentRootAggregator
      </aggregator-class>
      <properties>
        <property name="persistenceBackendClass">foo.bar.MyPersistenceBackend</property>
      </properties>
    </chain-root>
  </aggregator-chain>
</jetm-config>

A custom PersistenceBackend in a Spring 2.x environment:

<?xml version="1.0" encoding="UTF-8"?>
<beans ...>

  ...

  <jetm:runtime>
    <jetm:features>
      <jetm:persistence>
        <jetm:custom-backend class="foo.bar.MyPersistenceBackend" />
      </jetm:persistence>
    </jetm:features>
  </jetm:runtime>

</beans>

Custom PersistenceBackend implementations may require additional properties. Simply expose those properties as setter methods and they will be configured in a EtmManager or Spring 2.x environment automatically. See filename and path examples above for custom configuration properties. In Spring 1.x rely on Springframework IoC capabilities.