Just a second...

Configuring statistics

You can configure statistics using the etc/Statistics.xml configuration file or programmatically using the Publisher API.

Statistics and performance

Collecting and communicating statistics introduces a performance overhead on the Diffusion™ server.

Enabling client instance statistics in a solution with significant numbers of clients can cause up to 20% reduction in the maximum throughput achieved. This performance impact can inhibit the system from supporting further connections.

If your system has more than 20,000 concurrent client connections per Diffusion instance, we recommend that client instance statistics be turned off.

Enabling topic instance statistics causes the creation of 5 statistics topics for each of your own topics.

If your system supports very large number of topics, we recommend that topic instance statistics are turned off.

The Statistics.xml configuration file

Diffusion servers provide statistics which are made available in several ways:
  • Java Management Extensions (JMX) MBeans
  • as topics under Diffusion/Metrics
  • through the Diffusion monitoring console
  • as endpoints for Promotheus

If statistics is enabled via etc/Statistics.xml, users can take measurements including the average message size, number of messages per topic per second, etc.

The statistics configuration has several distinct elements, that allow granular control over what is enabled on server start.

  • <statistics>

    The top-level element. Setting the enabled property to false will disable all statistics for the server.

  • <topic-statistics>, <client-statistics>, <publisher-statistics>, and <server-statistics> (DEPRECATED)

    Enabling these elements provides aggregate metrics for each given class.

The collection of metrics is configured separately from the distribution thereof. Within the Statistics.xml configuration file, there is also a <reporters> element which contains definitions of available reporters, which expose metrics over different mediums.

Some reporters allow certain properties to be passed to them. For instance, the topics reporter allows the use of <property name="interval"> to provide the desired update frequency in seconds. Details of valid properties is documented within the etc/Statistics.xml file itself.

Configuring a reporter to distribute statistics through JMX

Inside the reporters element of the Statistics.xml configuration file, add the following XML:

<reporter name="JMX" enabled="true">
    <type>JMX</type>
</reporter>

Reporting statistics through JMX can have a significant performance impact. Ensure that you test how using MBeans for statistics affects your solution.

Configuring a reporter to distribute statistics through topics

Inside the reporters element of the Statistics.xml configuration file, add the following XML:

<reporter name="Topics" enabled="true">
    <type>TOPIC</type>
</reporter>

Programmatic configuration

You can programmatically query and configure the recording and calculation of statistics for the classes:

  • com.pushtechnology.diffusion.api.publisher.Client
  • com.pushtechnology.diffusion.api.topic.Topic
  • com.pushtechnology.diffusion.api.publisher.Publisher

Developers are able to query the state of each class, to discover whether it is recording statistics using method isStatisticsEnabled(), stop recording with stopStatistics() and start recording using startStatistics(). The relevant API documentation holds more detail on the subject.