SAP / cf-java-logging-support

The Java Logging Support for Cloud Foundry supports the creation of structured log messages and the collection of request metrics
Apache License 2.0
77 stars 48 forks source link

Introduce JHM Benchmarking for Log Backends #137

Closed KarstenSchnitter closed 2 years ago

KarstenSchnitter commented 2 years ago

Changes to the JSON encoding and messages generation overall may impact the library performance and with this the application performance. To provide a toolset to measure impact of changes in future, the Java Microbenchmarking Harness (JMH) was introduce with a few simple benchmarks. The are implemented separately for log4j2 and logback. The current results from my machine are as follow:

Logback:

Benchmark                                          Mode  Cnt       Score       Error  Units
EncodingBenchmarks.minimalRequestRecord           thrpt    5   84562,416 ±  8912,890  ops/s
EncodingBenchmarks.simpleLog                      thrpt    5  115365,061 ± 15645,826  ops/s
EncodingBenchmarks.singleCommonFieldFromMdc       thrpt    5  113844,805 ±  3235,766  ops/s
EncodingBenchmarks.singleCustomFieldFromArgument  thrpt    5  109952,525 ±  9775,466  ops/s

Log4j2:

Benchmark                                          Mode  Cnt       Score       Error  Units
EncodingBenchmarks.minimalRequestRecord           thrpt    5  114756,173 ±  7212,135  ops/s
EncodingBenchmarks.simpleLog                      thrpt    5  170957,170 ±  2546,579  ops/s
EncodingBenchmarks.singleCommonFieldFromMdc       thrpt    5  164589,191 ± 29621,024  ops/s
EncodingBenchmarks.singleCustomFieldFromArgument  thrpt    5  173940,242 ± 24513,865  ops/s

Signed-off-by: Karsten Schnitter k.schnitter@sap.com