Coder Social home page Coder Social logo

blast-core's Introduction

blast

Platform Build Status
Ubuntu latest blast_ubuntu_latest
macOS 12 blast_macos_12

blast is a load generator for TCP servers, especially if such servers maintain persistent connections.

Content Organization

Why blast

I am a part of the team that is developing a strongly consistent distributed key/value storage engine with support for rich queries. The distributed key/value storage engine has TCP servers that implement Single Socket Channel and Request Pipeline .

We needed a way to send load on our servers and get a report with details including total connections established, total requests sent, total responses read and time to get those responses back etc.

Another detail, our servers accept protobuf encoded messages as byte slices, so the tool should be able to send the load (/byte slice) in a format that the target servers can decode. Almost all distributed systems accept payloads in a very specific format. For example, JunoDB sends (and receives) OperationalMessage encoded as byte slice.

All we needed was a tool that can send load (or specific load) on target TCP servers, read responses from those servers and present a decent :) report. This was an opportunity to build blast. blast is inspired from hey, which is an HTTP load generator in golang.

blast-core

blast-core is the heart of blast CLI. It provides support for sending requests, reading payload from file, reading responses and generating reports. It also provides support parsing command line arguments to simplify building a custom CLI. More on this in the FAQs.

Features

blast-core provides the following features:

  1. Support for sending N requests per second per worker.
  2. Support for reading N total responses from the target server.
  3. Support for reading N successful responses from the target server.
  4. Support for customizing the load duration. By default, blast runs for 20 seconds.
  5. Support for sending requests to the target server with the specified concurrency level.
  6. Support for establishing N connections to the target server.
  7. Support for specifying the connection timeout.
  8. Support for printing the report.
  9. Support for sending dynamic payloads with PayloadGenerator.

FAQs

  1. How does blast-core support dynamic payload?

blast-core provides an interface called PayloadGenerator and ships with an implementation called ConstantPayloadGenerator. Anyone can implement the interface PayloadGenerator to generate dynamic payload.

  1. Does blast (CLI) provide support for dynamic payload?

No, blast CLI does not provide support for dynamic payload. To implement dynamic payload, one needs to create their own CLI. blast-core makes it easy to build a thin CLI. Creating a custom CLI involves the following:

  • Express the dependency on blast-core in go.mod
  • Write a thin main function that provides the implementation of PayloadGenerator

The main looks like the following:

func main() {
    commandArguments := blast.NewCommandArguments()
    blastInstance := commandArguments.ParseWithDynamicPayload(executableName, <<An implementation of PayloadGenerator>>)

    interruptChannel := make(chan os.Signal, 1)
    signal.Notify(interruptChannel, os.Interrupt)

    go func() {
        <-interruptChannel
        blastInstance.Stop()
    }()

    blastInstance.WaitForCompletion()
}
  1. Can I create custom CLI without using the parsing of command line arguments supported by blast-core?

Yes, you can always create a custom CLI that leverages blast-core's features. The custom CLI must create an instance of Blast struct which acts as an orchestrator between Workers, ResponseReader and Reporter.

References

hey

The logo is built using logo.com.

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.