benchmark

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: MIT Imports: 8 Imported by: 0

README

benchmark

压测rpc方法,并生成报告结果。

使用示例

func benchmarkExample() error {
	host := "127.0.0.1:8282"
	protoFile := "api/serverNameExample/v1/userExample.proto"
	// 如果压测过程中缺少第三方依赖,复制到项目的third_party目录下(不包括import路径)
	importPaths := []string{"third_party"}
	message := &pb.GetUserExampleByIDRequest{
		ID: 2,
	}

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

压测完毕后,复制输出的html文件路径到浏览器查看详细的压测报告。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Runner

type Runner interface {
	Run() error
}

func New

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

New 创建一个压测实例

Jump to

Keyboard shortcuts

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