Skip to content

3.x Configuration

LinShunKang edited this page Jan 4, 2021 · 5 revisions

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

Attribute Type Required Default Value Description
app_name String Yes Configure application name
debug boolean No false Configure debug mode, true/false
http.server.port int No 2048,2000,2040 Configure Http server port,format:preferPort,minBackupPort,maxBackupPort
http.server.min_workers int No 1 Configure Http server min work count
http.server.max_workers int No 2 Configure Http server max work count
http.server.accept_count int No 1024
Configure the maximum number of queued requests for the Http server
metrics.exporter String No log.stdout Configure MetricsExporter type, log.stdout:Output to stdout.log in a standard formatted structure; log.standard:Output to disk in standard formatted structure; log.influxdb:Output to disk in InfluxDB LineProtocol format; http.influxdb:Output to InfluxDB server in InfluxDB LineProtocol format; need configure influxdb configurations
metrics.log.method String No /data/logs/MyPerf4J/metrics.log Configure the log path of the Method Metrics. If the value is NULL, the collected MethodMetrics are discarded
metrics.log.class_loading String No NULL Configure the log path of the Class Loading Metrics. If the value is NULL, the collected Class Load Metrics are discarded
metrics.log.gc String No NULL Configure the log path of the GC Metrics. If the value is NULL, the collected GC Metrics are discarded
metrics.log.memory String No NULL Configure the log path of the Memory Metrics. If the value is NULL, the collected Memory Metrics are discarded
metrics.log.buff_pool String No NULL Configure the log path of the BufferPool Metrics. If the value is NULL, the collected BufferPool Metrics are discarded
metrics.log.thread String No NULL Configure the log path of the Thread Metrics. If the value is NULL, the collected ThreadMetrics are discarded
metrics.log.file_desc String No NULL Configure the log path of the FileDescriptor Metrics. If the value is NULL, the collected ThreadMetrics are discarded
metrics.log.compilation String No NULL Configure the log path of the Compilation Metrics. If the value is NULL, the collected ThreadMetrics are discarded
metrics.log.rolling.time_unit String No DAILY Configure the log file scrolling interval, which has three values: MINUTELY, HOURLY, and DAILY
metrics.log.reserve.count int No 7
Configure the number of historical log files to keep
metrics.time_slice.method int No 60000 Configure Method Metrics TimeSlice, time unit: ms, min:1s, max:600s
metrics.time_slice.jvm int No 60000 Configure JVM Metrics TimeSlice, time unit: ms, min:1s, max:600s
metrics.method.show_params boolean No false Config show method params type
metrics.method.class_level_mapping String No Config Class level mapping
recorder.mode String No rough Configure RecordMode,accurate/rough
recorder.size.timing_arr int No 1000
recorder.size.timing_map int No 16
recorders.backup_count Int No 1
filter.packages.include String Yes Configure packages to injects,separated with ';'
filter.packages.exclude String No Configure packages not to injects,separated with ';'
filter.methods.exclude String No Configure methods not to injects,separated with ';'
filter.methods.exclude_private boolean No true Configure not to injects private methods,separated with ';'true/false
filter.class_loaders.exclude String No Configure classloaders not to injects,separated with ';'
influxdb.host String No 127.0.0.1 Configure InfluxDB host
influxdb.port int No 8086 Configure InfluxDB port
influxdb.database String No Configure InfluxDB databse
influxdb.username String No Configure InfluxDB username
influxdb.password String No Configure InfluxDB password
influxdb.conn_timeout int No 3000 Configure InfluxDB connection timeout, unit: ms
influxdb.read_timeout int No 5000 Configure InfluxDB read timeout, unit: ms

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.

关于包路径规则

filter.packages.includefilter.packages.exclude 目前支持以下三种规则:

  • com.demo.p1 代表包含以 com.demo.p1 为前缀的所有包和类
  • [] 表示集合的概念:例如,com.demo.[p1,p2,p3] 代表包含以 com.demo.p1com.demo.p2com.demo.p3 为前缀的所有包和类,等价于 com.demo.p1;com.demo.p2;com.demo.p3
  • * 表示通配符:可以指代零个或多个字符,例如,com.*.demo.*

关于 filter.methods.exclude 的使用规则

filter.methods.exclude 目前支持以下三种规则:

  • filter.methods.exclude = getId1 代表排除所有方法名为 getId1 的方法
  • filter.methods.exclude = DemoServiceImpl.getId1 代表排除类 DemoServiceImpl 中所有方法名为 getId1 的方法
  • filter.methods.exclude = DemoServiceImpl.getId1(long) 代表排除类 DemoServiceImpl 中方法签名为 getId1(long) 的方法

关于 metrics.method.class_level_mapping 的使用规则

metrics.method.class_level_mapping 用于配置 Class 层级映射关系,格式为:LevelA:[classNameExpA1,classNameExpA2];LevelB:[classNameExpB1,classNameExpB2],以 metrics.method.class_level_mapping = Api:[*Api,*ApiImpl];Controller:[*Controller];为例:

  • Api:[*Api,*ApiImpl] 代表所有以 Api 和 ApiImpl 结尾的类的层级为 Api
  • Controller:[*Controller] 代表所有以 Controller 结尾的类的层级为 Controller
Clone this wiki locally