README ¶ Go - Structured Logging Benchmark by Magazine zum Globus A structured JSON logging performance benchmark providing realistic performance metrics for the latest versions of: sirupsen/logrus uber/zap rs/zerolog Performance is measured by the following main criteria: total alloc - Total size of allocated memory. num-gc - Total number of GC cycles. mallocs - Total number of allocated heap objects. total pause - Total duration of GC pauses. Average and total time of execution (by operation). i7-8569U @ 2.80GHz Getting started Install the benchmark: go get github.com/globusdigital/logbench Run it: logbench -w 8 -t 1_000_000 -o_all -l zerolog -w <num>: defines the number of concurrently writing goroutines. -l <logger>: enables a logger. You can enable multiple loggers by specifying multiple flags: -l zerolog -l zap -l logrus. -o <operation>: enables an operation. You can enable multiple operations by specifying multiple flags: -o info -o error -o info_with_3. -t <num>: defines the number of logs to be written for each operation. -o_all: enables all operations ignoring all specified -o flags -memprof <path>: specifies the output file path for the memory profile (disabled when not set) -mi <duration>: memory inspection interval How-to Adding a new logger to the benchmark Define the logger in a sub-package. Provide a Setup() benchmark.Setup function in your logger's sub-package. Implement all benchmark operations: FnInfo func(msg string) FnInfoFmt func(msg string, data int) FnError func(msg string) FnInfoWithErrorStack func(msg string, err error) FnInfoWith3 func(msg string, fields *benchmark.Fields3) FnInfoWith10 func(msg string, fields *benchmark.Fields10) FnInfoWith10Exist func(msg string) Add your setup to setups. Run the tests with go test -v -race ./... and make sure everything's working. Expand ▾ Collapse ▴ Documentation ¶ There is no documentation for this package. Source Files ¶ View all Source files flagList.go main.go printStatistics.go Directories ¶ Show internal Expand all Path Synopsis benchmark logrus zap zerolog Click to show internal directories. Click to hide internal directories.