A new statistics feature is added to Siddhi 3.0.5.
This will help users to find how their queries are behaving and to understand what query to optimise to get better performance and to optimise memory consumption.
This is very easy to enable and you can enable this by just adding
"@plan:statistics(reporter = 'console', interval = '5' )"
to the execution plan will start statistics reporting on console every 5 seconds.
You will be able to and output something like
"@plan:statistics(reporter = 'jmx')"
to report stats via jmx.
You can find a sample implementations here.
https://github.com/wso2/siddhi/blob/master/modules/siddhi-core/src/test/java/org/wso2/siddhi/core/managment/StatisticsTestCase.java
Siddhi also allows users to add custom reporting tools. To do so.
Just implement the StatisticsTrackerFactory interface
And add that to the Siddhi Manager
Happy Coding :)
This will help users to find how their queries are behaving and to understand what query to optimise to get better performance and to optimise memory consumption.
This is very easy to enable and you can enable this by just adding
"@plan:statistics(reporter = 'console', interval = '5' )"
to the execution plan will start statistics reporting on console every 5 seconds.
You will be able to and output something like
1/12/16 12:01:39 AM ============================================================ -- Gauges ---------------------------------------------------------------------- org.wso2.siddhi.executionplan.5910c3f3-1af3-43bd-ae6e-06b1a959eaf3.query1.memory value = 548804 org.wso2.siddhi.executionplan.5910c3f3-1af3-43bd-ae6e-06b1a959eaf3.query2.memory value = 556686 -- Meters ---------------------------------------------------------------------- org.wso2.siddhi.stream.cseEventStream.throughput count = 2 mean rate = 0.37 events/second 1-minute rate = 0.40 events/second 5-minute rate = 0.40 events/second 15-minute rate = 0.40 events/second org.wso2.siddhi.stream.cseEventStream2.throughput count = 0 mean rate = 0.00 events/second 1-minute rate = 0.00 events/second 5-minute rate = 0.00 events/second 15-minute rate = 0.00 events/second org.wso2.siddhi.stream.outputStream.throughput count = 3 mean rate = 0.57 events/second 1-minute rate = 0.60 events/second 5-minute rate = 0.60 events/second 15-minute rate = 0.60 events/second -- Timers ---------------------------------------------------------------------- org.wso2.siddhi.executionplan.5910c3f3-1af3-43bd-ae6e-06b1a959eaf3.query1.latency count = 2 mean rate = 0.38 calls/second 1-minute rate = 0.40 calls/second 5-minute rate = 0.40 calls/second 15-minute rate = 0.40 calls/second min = 0.01 milliseconds max = 0.08 milliseconds mean = 0.05 milliseconds stddev = 0.04 milliseconds median = 0.08 milliseconds 75% <= 0.08 milliseconds 95% <= 0.08 milliseconds 98% <= 0.08 milliseconds 99% <= 0.08 milliseconds 99.9% <= 0.08 milliseconds org.wso2.siddhi.executionplan.5910c3f3-1af3-43bd-ae6e-06b1a959eaf3.query2.latency count = 2 mean rate = 0.38 calls/second 1-minute rate = 0.40 calls/second 5-minute rate = 0.40 calls/second 15-minute rate = 0.40 calls/second min = 0.01 milliseconds max = 0.01 milliseconds mean = 0.01 milliseconds stddev = 0.00 milliseconds median = 0.01 milliseconds 75% <= 0.01 milliseconds 95% <= 0.01 milliseconds 98% <= 0.01 milliseconds 99% <= 0.01 milliseconds 99.9% <= 0.01 millisecondsYou can also add
"@plan:statistics(reporter = 'jmx')"
to report stats via jmx.
You can find a sample implementations here.
https://github.com/wso2/siddhi/blob/master/modules/siddhi-core/src/test/java/org/wso2/siddhi/core/managment/StatisticsTestCase.java
Siddhi also allows users to add custom reporting tools. To do so.
Just implement the StatisticsTrackerFactory interface
package org.wso2.siddhi.core.util.statistics; import org.wso2.siddhi.query.api.annotation.Element; import java.util.List; public interface StatisticsTrackerFactory { LatencyTracker createLatencyTracker(String name, StatisticsManager statisticsManager); ThroughputTracker createThroughputTracker(String name, StatisticsManager statisticsManager); MemoryUsageTracker createMemoryUsageTracker(StatisticsManager statisticsManager); StatisticsManager createStatisticsManager(List<Element> elements); }
And add that to the Siddhi Manager
siddhiManager.setStatisticsConfiguration(new StatisticsConfiguration(new MyMetricsFactory()));
Happy Coding :)