Skip to content

Configuration

LinShunkang edited this page Oct 28, 2018 · 10 revisions

MyPerf4J provides the following Attribute by default to control the behavior of MyPerf4J:

Attribute Type Required Default Value Description
AppName String Yes Configure application name
MetricsProcessorType int No 0 Configure MetricsProcessors type 0:Output to stdout.log in a standard formatted structure 1:Output to disk in standard formatted structure 2:Output to disk in InfluxDB LineProtocol format
MethodMetricsFile String No /data/logs/MyPerf4J/metrics.log Configure the log path of the MethodMetrics. If the value is NULL, the collected MethodMetrics are discarded.
ClassMetricsFile String No NULL Configure the log path of the ClassMetrics. If the value is NULL, the collected ClassMetrics are discarded.
GCMetricsFile String No NULL Configure the log path of the GCMetrics. If the value is NULL, the collected GCMetrics are discarded.
MemMetricsFile String No NULL Configure the log path of the MemMetrics. If the value is NULL, the collected MemMetrics are discarded.
ThreadMetricsFile String No NULL Configure the log path of the ThreadMetrics. If the value is NULL, the collected ThreadMetrics are discarded.
LogRollingTimeUnit String No DAILY Configure the log file scrolling interval, which has three values: MINUTELY, HOURLY, and DAILY.
RecorderMode String No rough Configure RecordMode,accurate/rough
MilliTimeSlice int No 30000 Configure TimeSlice, time unit: ms, min:1s, max:600s
ShowMethodParams boolean No false Config show method params type
BackupRecordersCount Int No 1 Configure BackupRecordersCount, min:1s, max:8. When you need to count a large number of method performance data in a smaller MillTimeSlice, you can configure a larger number
IncludePackages String Yes Configure packages to injects,separated with ';'
ExcludePackages String No Configure packages not to injects,separated with ';'
Debug.PrintDebugLog boolean No false Configure print debug, true/false
ExcludeMethods String No Configure methods not to injects, separated with ';'
ExcludePrivateMethod boolean No true Configure injects private method or not
ExcludeClassLoaders String No Configure ClassLoader not to injects,separated with ';'
ProfilingParamsFile String No The configuration file performs memory usage tuning by specifying certain method execution time thresholds, such as /your/path/to/myPerf4J.profilingParams
ProfilingTimeThreshold int No 1000 General method execution time threshold in ms
ProfilingOutThresholdCount int No 16 The number of times the method execution time threshold is exceeded in a time slice, valid only when RecorderMode=accurate

About Rough Mode and Accurate Mode

  • Rough Mode
    • The accuracy is slightly worse.
    • It saves more memory, and only uses array to record response time.
    • The speed is a little faster.
    • Default mode.
  • Accurate Mode

    • High accuracy, records all response times.
    • It consumes relatively memory and uses array & Map to record response time.
    • The speed is slightly slower.
    • Need to add property RecorderMode=accurate in /your/path/to/myPerf4J.properties.
  • Suggestions

    • For memory-sensitive or precision applications that are not particularly demanding, Rough Mode is recommended.
    • The Accurate Mode is recommended for applications that are insensitive to memory and require high accuracy.

About ProfilingParamsFile

ProfilingParamsFile is used to specify the response time threshold for each specific method and the number of times the threshold is exceeded, allowing MyPerf4J to count more methods with less memory.

  • Specify ProfilingParamsFile=/your/path/to/myPerf4J.profilingParams in /your/path/to/myPerf4J.properties

  • The configuration in /your/path/to/myPerf4J.profilingParams is as follows:

    #Format is: 
    #fullClassName.methodName=threshold(ms):exceededNumber
    cn.perf4j.demo.DemoServiceImpl.getId1=1000:10
    cn.perf4j.demo.DemoServiceImpl.getId2=2000:20 
    
Clone this wiki locally