blast-core

module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0

README

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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