Performance Monitor
Introduction
In order to grasp the performance of iotdb, we add this module to count the time-consuming of each operation. This module can statistic the avg time-consuming of each operation and the proportion of each operation fall into a time range. The output is in log_measure.log file. A output example is in below.
Configuration parameter
location:conf/iotdb-engine.properties
**Table -parameter and description**
Parameter | Default Value | Description |
---|---|---|
enable_performance_stat | false | Is stat performance of sub-module enable. |
performance_stat_display_interval | 60000 | The interval of display statistic result in ms. |
performance_stat_memory_in_kb | 20 | The memory used for performance_stat in kb. |
JMX MBean
Connect to jconsole with port 31999,and choose ‘MBean’in menu bar. Expand the sidebar and choose ‘org.apache.iotdb.db.cost.statistic’. You can Find:
Attribute
EnableStat:Whether the statistics are enable or not, if it is true, the module records the time-consuming of each operation and prints the results; It can not be set dynamically but changed by function in below.
DisplayIntervalInMs:The interval between print results. It can be set dynamically, but will take effect after restart.( First call stopStatistic(), then call startContinuousStatistics() or startOneTimeStatistics())
OperationSwitch:It’s a map to indicate whether stat the operation, the key is operation name and the value is stat state. This parameter cannot be changed directly, it’s change by operation ‘changeOperationSwitch()’.
Operation
- startContinuousStatistics: Start the statistics and output at interval of ‘DisplayIntervalInMs’.
- startOneTimeStatistics:Start the statistics and output in delay of ‘DisplayIntervalInMs’.
- stopStatistic:Stop the statistics.
- clearStatisticalState(): clear current stat result, reset statistical result.
- changeOperationSwitch(String operationName, Boolean operationState):set whether to monitor operation status. The param ‘operationName’ is the name of operation, defined in attribute operationSwitch. The param operationState is the state of operation. If state-switch successful the function will return true, else return false.
Adding Custom Monitoring Items for developer of IOTDB
Add Operation
Add an enumeration in org.apache.iotdb.db.cost.statistic.Operation.
Add Timing Code in Monitoring Area
Add timing code in the monitoring start area:
long t0 = System. currentTimeMillis();
Add timing code in the monitoring stop area:
Measurement.INSTANCE.addOperationLatency(Operation, t0);