logbench

command module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2020 License: BSD-3-Clause Imports: 18 Imported by: 0

README

GoReportCard Coverage Status

Go - Structured Logging Benchmark
by Magazine zum Globus

A structured JSON logging performance benchmark providing realistic performance metrics for the latest versions of:

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).

Benchmark Results i7-8569U @ 2.80GHz

Getting started

  1. Install the benchmark:
go get github.com/globusdigital/logbench
  1. 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

    1. Define the logger in a sub-package.
    1. Provide a Setup() benchmark.Setup function in your logger's sub-package.
    1. 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)
    1. Add your setup to setups.
    1. Run the tests with go test -v -race ./... and make sure everything's working.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL