benchmark

package
v1.5.14 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 8 Imported by: 0

README

benchmark

Compression testing of rpc methods and generation of reported results.

Example of use

import "github.com/zhufuyi/sponge/pkg/grpc/benchmark"

func benchmarkExample() error {
	host := "127.0.0.1:8282"
	protoFile := "api/serverNameExample/v1/userExample.proto"
	// if third-party dependencies are missing during the press test, copy them to the project's third_party directory (not including the import path)
	importPaths := []string{"third_party"}
	message := &serverNameV1.GetUserExampleByIDRequest{
		ID: 2,
	}

	b, err := benchmark.New(host, protoFile, "GetByID", message, 1000, importPaths...)
	if err != nil {
		return err
	}
	return b.Run()
}

Once the crush is complete, copy the output html file path to your browser to view the detailed crush report.

Documentation

Overview

Package benchmark is compression testing of rpc methods and generation of reported results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

type Runner interface {
	Run() error
}

Runner interface

func New

func New(host string, protoFile string, methodName string, req proto.Message, total uint, importPaths ...string) (Runner, error)

New create a pressure test instance

Jump to

Keyboard shortcuts

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