benchmark

package
v1.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 7 Imported by: 0

README

benchmark

Compression testing of rpc methods and generation of reported results.

Example of use

import "github.com/18721889353/sunshine/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 Option

type Option = runner.Option

type Runner

type Runner interface {
	Run() error
}

Runner interface

func New

func New(host string, protoFile string, methodName string, req proto.Message, dependentProtoFilePath []string, total int, options ...runner.Option) (Runner, error)

New create a pressure test instance

invalid parameter total if the option runner.WithRunDuration is set

Jump to

Keyboard shortcuts

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