diff options
| author | Paul Buetow <paul@buetow.org> | 2026-01-09 23:26:31 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-01-09 23:26:31 +0200 |
| commit | 15ea7f40cd7302b9bf9f0aea0d85a970a8a7c07f (patch) | |
| tree | 897055fcb651cae1f5e96e14c966243325e95286 /src/main/java/bench/BenchConfig.java | |
Add Log4j2 benchmark tool
- Configurable thread count, duration, message size
- Multiple logging configurations: sync-immediate, sync-buffered
- AsyncLogger variants: 1k, 4k, 10k, 1m ring buffer sizes
- AsyncAppender variants: 1k, 4k, 10k, 1m buffer sizes
- Subprocess isolation for proper async logger initialization
- Cache dropping between tests for accurate benchmarks
- CSV output support
Diffstat (limited to 'src/main/java/bench/BenchConfig.java')
| -rw-r--r-- | src/main/java/bench/BenchConfig.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/main/java/bench/BenchConfig.java b/src/main/java/bench/BenchConfig.java new file mode 100644 index 0000000..cc73444 --- /dev/null +++ b/src/main/java/bench/BenchConfig.java @@ -0,0 +1,48 @@ +package bench; + +import java.util.List; + +public class BenchConfig { + public enum Mode { DURATION, EVENTS } + + private int threads = 10; + private Mode mode = Mode.DURATION; + private long durationSeconds = 10; + private long totalEvents = 1_000_000; + private long warmupSeconds = 3; + private int messageSize = 100; + private List<String> configs = List.of( + "sync-immediate", "sync-buffered", + "async-1k", "async-4k", "async-10k", + "asyncapp-1k", "asyncapp-4k", "asyncapp-10k" + ); + private String outputFile = null; + + public int getThreads() { return threads; } + public void setThreads(int threads) { this.threads = threads; } + + public Mode getMode() { return mode; } + public void setMode(Mode mode) { this.mode = mode; } + + public long getDurationSeconds() { return durationSeconds; } + public void setDurationSeconds(long durationSeconds) { this.durationSeconds = durationSeconds; } + + public long getTotalEvents() { return totalEvents; } + public void setTotalEvents(long totalEvents) { this.totalEvents = totalEvents; } + + public long getWarmupSeconds() { return warmupSeconds; } + public void setWarmupSeconds(long warmupSeconds) { this.warmupSeconds = warmupSeconds; } + + public int getMessageSize() { return messageSize; } + public void setMessageSize(int messageSize) { this.messageSize = messageSize; } + + public List<String> getConfigs() { return configs; } + public void setConfigs(List<String> configs) { this.configs = configs; } + + public String getOutputFile() { return outputFile; } + public void setOutputFile(String outputFile) { this.outputFile = outputFile; } + + public String generateMessage() { + return "X".repeat(messageSize); + } +} |
