GithubHelp home page GithubHelp logo

hatamiarash7 / barmak Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 72 KB

Benchmark of Kafka libraries for Go

Makefile 21.91% Gnuplot 11.74% Go 66.35%
benchmark benchmarking confluent go goka golang kafka kafka-benchmark kafka-go sarama

barmak's Introduction

Barmak

This is a simple project to test 4 popular Kafka libraries for Go. Our libraries are :

How to

We can get a simple benchmark from these libraries.

func BenchmarkProduceConfluent(b *testing.B) {
    count := b.N

    messages := make([]Message, count)

    for i := 0; i < count; i++ {
        messages[i] = Message{Key: "Confluent", Value: fmt.Sprint(i)}
    }

    Confluent(messages)
}

Run

There is a Makefile for you to run all commands.

Usage: make [target]

  help        Show this help message
  build       Build app's binary
  run         Run the app
  test        Run unit tests
  benchmark   Run benchmark tests

Change configuration in kafka/produce.go :

var (
    host   string   = "localhost:9092"
    topic  string   = "benchmark"
)

Then, execute the following command to run the benchmark:

$ make benchmark

goos: darwin
goarch: arm64
pkg: arash-hatami.ir/Barmak/kafka
BenchmarkProduceSegmentio-8          367           3235080 ns/op
BenchmarkProduceConfluent-8         1137           1006395 ns/op
BenchmarkProduceSarama-8             496           2136077 ns/op
BenchmarkProduceGoka-8                10         104631917 ns/op
PASS
ok      arash-hatami.ir/Barmak/kafka    6.299s
'graphic/operations.png' and 'graphic/time_operations.png' graphics were generated.

And you can see the results in graphic directory.

Total number of operations :

operations

Operation in nanoseconds :

time_operations

Default process will be handled by the Go testing package. We can also use -benchtime=100x argument to set the minimum amount of time that the benchmark function will run.

Note: You can change the range for values in y axis. Set y_range_max in Makefile as needed.


Support ๐Ÿ’›

Donate with Bitcoin Donate with Ethereum

ko-fi

Contributing ๐Ÿค

Don't be shy and reach out to us if you want to contribute ๐Ÿ˜‰

  1. Fork it !
  2. Create your feature branch : git checkout -b my-new-feature
  3. Commit your changes : git commit -am 'Add some feature'
  4. Push to the branch : git push origin my-new-feature
  5. Submit a pull request

Issues

Each project may have many problems. Contributing to the better development of this project by reporting them. ๐Ÿ‘

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.