Skip to content

Commit fce03b2

Browse files
committed
benchmark results added
1 parent 42fe18e commit fce03b2

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

README.md

+62-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ That feature set reflects the features that a modern logging api should provide:
4040
- add a timestamp, the current thread and the name of the caller class to the message
4141
- log to file system and/or console
4242

43-
Since some loggers does not provide some of the features a simple implementation is part of the `com.openelements.logger.api.Logger` implementation for that logger lib.
43+
Since some loggers do not provide some of the features a simple implementation is part of the `com.openelements.logger.api.Logger` implementation for that logger lib.
4444

4545
## How to add a new logging library?
4646

@@ -54,6 +54,52 @@ All logging libraries execute that code to generate comparable results.
5454
Since the project evolved over time, the results are not always comparable.
5555
The [benchmark archive](BENCHMARK_HISTORY.MD) contains the results of benchmarks of all previous version of the repository.
5656

57+
### Benchmark results for current version
58+
59+
I always try to execute the benchmark on as many setups as possible. If you have a different setup and are willing to contribute performance results please create an issue :)
60+
61+
#### Execution on M1 Max MacBook with 64 GB RAM and local SSD
62+
63+
The benchmark has been executed with the following options:
64+
65+
- Forks: 4
66+
- Threads: 4
67+
- Warmup iterations: 4
68+
- Warmup time: 4 seconds
69+
- Measurement iterations: 4
70+
- Measurement time: 4 seconds
71+
72+
The following table contains the results of the benchmark for logging a simple "hello world" message:
73+
74+
| Logger | Logging Appender | Operations per second |
75+
|-------------------|------------------------|------------------------:|
76+
| Chronicle Logger | FILE_ASYNC | 2224759 |
77+
| Log4J2 | FILE_ASYNC | 902715 |
78+
| SLF4J Simple | FILE | 300924 |
79+
| Log4J2 | FILE | 163218 |
80+
| Java Util Logging | FILE | 103076 |
81+
| Log4J2 | FILE_AND_CONSOLE | 89460 |
82+
| Java Util Logging | CONSOLE | 83442 |
83+
| Log4J2 | CONSOLE | 72365 |
84+
| Log4J2 | FILE_ASYNC_AND_CONSOLE | 64143 |
85+
| Java Util Logging | FILE_AND_CONSOLE | 49268 |
86+
87+
The following table contains the results of the benchmark for executing the `LogLikeHell` Runnable that contains all possible logging operations:
88+
89+
| Logger | Logging Appender | Operations per second |
90+
|-------------------|------------------------|----------------------:|
91+
| Chronicle Logger | FILE_ASYNC | 57270 |
92+
| Log4J2 | FILE_ASYNC | 33770 |
93+
| Log4J2 | FILE | 9880 |
94+
| Java Util Logging | FILE | 6373 |
95+
| SLF4J Simple | FILE | 6091 |
96+
| Java Util Logging | FILE_AND_CONSOLE | 1918 |
97+
| Log4J2 | FILE_ASYNC_AND_CONSOLE | 1610 |
98+
| Java Util Logging | CONSOLE | 1539 |
99+
| Log4J2 | FILE_AND_CONSOLE | 1436 |
100+
| Log4J2 | CONSOLE | 985 |
101+
102+
57103
### Logger initialization
58104

59105
Since `v0.2.0` the repo contains benchmarks that check the initialization time of the logger.
@@ -65,6 +111,21 @@ The benchmarks prove that independent of the used logging library the performanc
65111
We assume that the behavior is based on the implementation of the `java.io.PrintStream` that is used for `System.out` / `System.err`.
66112
The class uses synchronized blocks to write to the console.
67113

114+
### Performance variance
115+
116+
The setups that use an async file logging have a much higher variance than the setups that use a sync file logging.
117+
Especially the Chronicle Logger has a high variance.
118+
We assume that this behavior is based on the internally used [Chronicle Queue library](https://github.com/OpenHFT/Chronicle-Queue).
119+
120+
The following table contains the results of the benchmark for executing the `LogLikeHell` Runnable:
121+
122+
| Logger | Logging Appender | Variance in operations per second |
123+
|-------------------|------------------|----------------------------------:|
124+
| Chronicle Logger | FILE_ASYNC | ±15000 |
125+
| Log4J2 | FILE_ASYNC | ±1500 |
126+
| All other setups | ALL | ±300 |
127+
128+
68129
## Kudos
69130

70131
The following people helped to improve the benchmark:

0 commit comments

Comments
 (0)