From bfcecc1279b81172b1533cef0eb60a4ac3366187 Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Thu, 14 Mar 2024 18:32:46 +0100 Subject: [PATCH 01/11] Add a load config option to TPS loader --- integration/benchmark/cmd/ci/main.go | 115 +++-- integration/benchmark/cmd/ci/server.go | 28 -- integration/benchmark/contLoadGenerator.go | 15 +- integration/benchmark/mocksiface/mocks.go | 10 - integration/benchmark/proto/generate.go | 3 - .../benchmark/proto/macro_benchmark.pb.go | 435 ------------------ .../benchmark/proto/macro_benchmark.proto | 28 -- .../proto/macro_benchmark_grpc.pb.go | 243 ---------- integration/benchmark/server/bench.sh | 4 +- integration/benchmark/server/branches.recent | 0 integration/benchmark/server/commits.recent | 1 - integration/benchmark/server/flow-go | 1 - integration/benchmark/server/load-config.yml | 12 + integration/benchmark/worker_stats_tracker.go | 2 +- integration/go.mod | 2 +- 15 files changed, 103 insertions(+), 796 deletions(-) delete mode 100644 integration/benchmark/cmd/ci/server.go delete mode 100644 integration/benchmark/mocksiface/mocks.go delete mode 100644 integration/benchmark/proto/generate.go delete mode 100644 integration/benchmark/proto/macro_benchmark.pb.go delete mode 100644 integration/benchmark/proto/macro_benchmark.proto delete mode 100644 integration/benchmark/proto/macro_benchmark_grpc.pb.go delete mode 100644 integration/benchmark/server/branches.recent delete mode 100644 integration/benchmark/server/commits.recent delete mode 160000 integration/benchmark/server/flow-go create mode 100644 integration/benchmark/server/load-config.yml diff --git a/integration/benchmark/cmd/ci/main.go b/integration/benchmark/cmd/ci/main.go index b5f68cc0ec7..1058f4d5541 100644 --- a/integration/benchmark/cmd/ci/main.go +++ b/integration/benchmark/cmd/ci/main.go @@ -3,7 +3,7 @@ package main import ( "context" "flag" - "net" + "gopkg.in/yaml.v3" "os" "strings" "time" @@ -21,7 +21,6 @@ import ( client "github.com/onflow/flow-go-sdk/access/grpc" "github.com/onflow/flow-go/integration/benchmark" - pb "github.com/onflow/flow-go/integration/benchmark/proto" "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/module/metrics" "github.com/onflow/flow-go/utils/unittest" @@ -33,7 +32,7 @@ type BenchmarkInfo struct { // Hardcoded CI values const ( - defaultLoadType = "token-transfer" + defaultLoadType = load.TokenTransferLoadType metricport = uint(8080) accessNodeAddress = "127.0.0.1:4001" pushgateway = "127.0.0.1:9091" @@ -45,35 +44,43 @@ const ( defaultMetricCollectionInterval = 20 * time.Second // gRPC constants - defaultMaxMsgSize = 1024 * 1024 * 16 // 16 MB - defaultGRPCAddress = "127.0.0.1:4777" + defaultMaxMsgSize = 1024 * 1024 * 16 // 16 MB ) func main() { logLvl := flag.String("log-level", "info", "set log level") // CI relevant flags - grpcAddressFlag := flag.String("grpc-address", defaultGRPCAddress, "listen address for gRPC server") initialTPSFlag := flag.Int("tps-initial", 10, "starting transactions per second") maxTPSFlag := flag.Int("tps-max", *initialTPSFlag, "maximum transactions per second allowed") minTPSFlag := flag.Int("tps-min", *initialTPSFlag, "minimum transactions per second allowed") + loadTypeFlag := flag.String("load-type", string(defaultLoadType), "load type (token-transfer / const-exec / evm from the load config file)") + loadConfigFileLocationFlag := flag.String("load-config-file", "", "load config file location. If not provided, default config will be used.") + adjustIntervalFlag := flag.Duration("tps-adjust-interval", defaultAdjustInterval, "interval for adjusting TPS") adjustDelayFlag := flag.Duration("tps-adjust-delay", 120*time.Second, "delay before adjusting TPS") - statIntervalFlag := flag.Duration("stat-interval", defaultMetricCollectionInterval, "") durationFlag := flag.Duration("duration", 10*time.Minute, "test duration") + + statIntervalFlag := flag.Duration("stat-interval", defaultMetricCollectionInterval, "") gitRepoPathFlag := flag.String("git-repo-path", "../..", "git repo path of the filesystem") gitRepoURLFlag := flag.String("git-repo-url", "https://github.com/onflow/flow-go.git", "git repo URL") bigQueryUpload := flag.Bool("bigquery-upload", true, "whether to upload results to BigQuery (true / false)") bigQueryProjectFlag := flag.String("bigquery-project", "dapperlabs-data", "project name for the bigquery uploader") bigQueryDatasetFlag := flag.String("bigquery-dataset", "dev_src_flow_tps_metrics", "dataset name for the bigquery uploader") bigQueryRawTableFlag := flag.String("bigquery-raw-table", "rawResults", "table name for the bigquery raw results") - loadTypeFlag := flag.String("load-type", defaultLoadType, "load type (token-transfer / const-exec / evm)") flag.Parse() - loadType := *loadTypeFlag - log := setupLogger(logLvl) + loadConfig := getLoadConfig( + log, + *loadConfigFileLocationFlag, + *loadTypeFlag, + *minTPSFlag, + *maxTPSFlag, + *initialTPSFlag, + ) + if *gitRepoPathFlag == "" { flag.PrintDefaults() log.Fatal().Msg("git repo path is required") @@ -86,26 +93,6 @@ func main() { <-server.Ready() loaderMetrics := metrics.NewLoaderCollector() - grpcServerOptions := []grpc.ServerOption{ - grpc.MaxRecvMsgSize(defaultMaxMsgSize), - grpc.MaxSendMsgSize(defaultMaxMsgSize), - } - grpcServer := grpc.NewServer(grpcServerOptions...) - defer grpcServer.Stop() - - pb.RegisterBenchmarkServer(grpcServer, &benchmarkServer{}) - - grpcListener, err := net.Listen("tcp", *grpcAddressFlag) - if err != nil { - log.Fatal().Err(err).Str("address", *grpcAddressFlag).Msg("failed to listen") - } - - go func() { - if err := grpcServer.Serve(grpcListener); err != nil { - log.Fatal().Err(err).Msg("failed to serve") - } - }() - sp := benchmark.NewStatsPusher(ctx, log, pushgateway, "loader", prometheus.DefaultGatherer) defer sp.Stop() @@ -136,10 +123,7 @@ func main() { // prepare load generator log.Info(). - Str("load_type", loadType). - Int("initialTPS", *initialTPSFlag). - Int("minTPS", *minTPSFlag). - Int("maxTPS", *maxTPSFlag). + Interface("loadConfig", loadConfig). Dur("duration", *durationFlag). Msg("Running load case") @@ -164,7 +148,7 @@ func main() { }, benchmark.LoadParams{ NumberOfAccounts: maxInflight, - LoadType: load.LoadType(loadType), + LoadConfig: loadConfig, FeedbackEnabled: feedbackEnabled, }, ) @@ -187,9 +171,9 @@ func main() { AdjusterParams{ Delay: *adjustDelayFlag, Interval: *adjustIntervalFlag, - InitialTPS: uint(*initialTPSFlag), - MinTPS: uint(*minTPSFlag), - MaxTPS: uint(*maxTPSFlag), + InitialTPS: uint(loadConfig.TPSInitial), + MinTPS: uint(loadConfig.TpsMin), + MaxTPS: uint(loadConfig.TpsMax), MaxInflight: uint(maxInflight / 2), }, ) @@ -218,7 +202,7 @@ func main() { // only upload valid data if *bigQueryUpload { repoInfo := MustGetRepoInfo(log, *gitRepoURLFlag, *gitRepoPathFlag) - mustUploadData(ctx, log, recorder, repoInfo, *bigQueryProjectFlag, *bigQueryDatasetFlag, *bigQueryRawTableFlag, loadType) + mustUploadData(ctx, log, recorder, repoInfo, *bigQueryProjectFlag, *bigQueryDatasetFlag, *bigQueryRawTableFlag, loadConfig.LoadName) } else { log.Info().Int("raw_tps_size", len(recorder.BenchmarkResults.RawTPS)).Msg("logging tps results locally") // log results locally when not uploading to BigQuery @@ -228,6 +212,55 @@ func main() { } } +func getLoadConfig( + log zerolog.Logger, + loadConfigLocation string, + load string, + minTPS int, + maxTPS int, + initialTPS int, +) benchmark.LoadConfig { + if loadConfigLocation == "" { + lc := benchmark.LoadConfig{ + LoadName: load, + LoadType: load, + TpsMax: maxTPS, + TpsMin: minTPS, + TPSInitial: initialTPS, + } + + log.Info(). + Interface("loadConfig", lc). + Msg("Load config file not provided, using parameters supplied in TPS flags") + return lc + } + + var loadConfigs map[string]benchmark.LoadConfig + + // check if the file exists + if _, err := os.Stat(loadConfigLocation); os.IsNotExist(err) { + log.Fatal().Err(err).Str("loadConfigLocation", loadConfigLocation).Msg("load config file not found") + } + + yamlFile, err := os.ReadFile(loadConfigLocation) + if err != nil { + log.Fatal().Err(err).Str("loadConfigLocation", loadConfigLocation).Msg("failed to read load config file") + } + + err = yaml.Unmarshal(yamlFile, &loadConfigs) + if err != nil { + log.Fatal().Err(err).Str("loadConfigLocation", loadConfigLocation).Msg("failed to unmarshal load config file") + } + + lc, ok := loadConfigs[load] + if !ok { + log.Fatal().Str("load", load).Msg("load not found in load config file") + } + lc.LoadName = load + + return lc +} + // setupLogger parses log level and apply to logger func setupLogger(logLvl *string) zerolog.Logger { log := zerolog.New(os.Stderr). @@ -252,7 +285,7 @@ func mustUploadData( bigQueryProject string, bigQueryDataset string, bigQueryRawTable string, - loadType string, + loadName string, ) { log.Info().Msg("Initializing BigQuery") db, err := NewDB(ctx, log, bigQueryProject) @@ -278,7 +311,7 @@ func mustUploadData( bigQueryRawTable, recorder.BenchmarkResults, *repoInfo, - BenchmarkInfo{BenchmarkType: loadType}, + BenchmarkInfo{BenchmarkType: loadName}, MustGetDefaultEnvironment(), ) if err != nil { diff --git a/integration/benchmark/cmd/ci/server.go b/integration/benchmark/cmd/ci/server.go deleted file mode 100644 index ba72e856ed4..00000000000 --- a/integration/benchmark/cmd/ci/server.go +++ /dev/null @@ -1,28 +0,0 @@ -package main - -import ( - "context" - - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/types/known/emptypb" - - pb "github.com/onflow/flow-go/integration/benchmark/proto" -) - -type benchmarkServer struct { - pb.UnimplementedBenchmarkServer -} - -func (s *benchmarkServer) StartMacroBenchmark(*pb.StartMacroBenchmarkRequest, pb.Benchmark_StartMacroBenchmarkServer) error { - return status.Errorf(codes.Unimplemented, "method StartMacroBenchmark not implemented") -} -func (s *benchmarkServer) GetMacroBenchmark(context.Context, *pb.GetMacroBenchmarkRequest) (*pb.GetMacroBenchmarkResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetMacroBenchmark not implemented") -} -func (s *benchmarkServer) ListMacroBenchmarks(context.Context, *emptypb.Empty) (*pb.ListMacroBenchmarksResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListMacroBenchmarks not implemented") -} -func (s *benchmarkServer) Status(context.Context, *emptypb.Empty) (*pb.StatusResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") -} diff --git a/integration/benchmark/contLoadGenerator.go b/integration/benchmark/contLoadGenerator.go index df78ca74c0a..41081de7163 100644 --- a/integration/benchmark/contLoadGenerator.go +++ b/integration/benchmark/contLoadGenerator.go @@ -46,9 +46,20 @@ type NetworkParams struct { ChainId flow.ChainID } +type LoadConfig struct { + // LoadName is the name of the load. This can be different from the LoadType + // and is used to identify the load in the results. The use case is when a single + // load type is used to run multiple loads with different parameters. + LoadName string `yaml:"-"` + LoadType string `yaml:"load_type"` + TpsMax int `default:"1200" yaml:"tps_max"` + TpsMin int `default:"1" yaml:"tps_min"` + TPSInitial int `yaml:"tps_initial"` +} + type LoadParams struct { NumberOfAccounts int - LoadType load.LoadType + LoadConfig LoadConfig // TODO(rbtz): inject a TxFollower FeedbackEnabled bool @@ -157,7 +168,7 @@ func New( Proposer: servAcc, } - l := load.CreateLoadType(log, loadParams.LoadType) + l := load.CreateLoadType(log, load.LoadType(loadParams.LoadConfig.LoadType)) err = l.Setup(log, lc) if err != nil { diff --git a/integration/benchmark/mocksiface/mocks.go b/integration/benchmark/mocksiface/mocks.go deleted file mode 100644 index 0068b5676c2..00000000000 --- a/integration/benchmark/mocksiface/mocks.go +++ /dev/null @@ -1,10 +0,0 @@ -package mocksiface_test - -import ( - "github.com/onflow/flow-go-sdk/access" -) - -// This is a proxy for the real access.Client for mockery to use. -type Client interface { - access.Client -} diff --git a/integration/benchmark/proto/generate.go b/integration/benchmark/proto/generate.go deleted file mode 100644 index b36797e4592..00000000000 --- a/integration/benchmark/proto/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative macro_benchmark.proto - -package proto diff --git a/integration/benchmark/proto/macro_benchmark.pb.go b/integration/benchmark/proto/macro_benchmark.pb.go deleted file mode 100644 index 15fdb7b4cf9..00000000000 --- a/integration/benchmark/proto/macro_benchmark.pb.go +++ /dev/null @@ -1,435 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.9 -// source: macro_benchmark.proto - -package proto - -import ( - reflect "reflect" - sync "sync" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type StartMacroBenchmarkRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *StartMacroBenchmarkRequest) Reset() { - *x = StartMacroBenchmarkRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_macro_benchmark_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StartMacroBenchmarkRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StartMacroBenchmarkRequest) ProtoMessage() {} - -func (x *StartMacroBenchmarkRequest) ProtoReflect() protoreflect.Message { - mi := &file_macro_benchmark_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StartMacroBenchmarkRequest.ProtoReflect.Descriptor instead. -func (*StartMacroBenchmarkRequest) Descriptor() ([]byte, []int) { - return file_macro_benchmark_proto_rawDescGZIP(), []int{0} -} - -type StartMacroBenchmarkResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *StartMacroBenchmarkResponse) Reset() { - *x = StartMacroBenchmarkResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_macro_benchmark_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StartMacroBenchmarkResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StartMacroBenchmarkResponse) ProtoMessage() {} - -func (x *StartMacroBenchmarkResponse) ProtoReflect() protoreflect.Message { - mi := &file_macro_benchmark_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StartMacroBenchmarkResponse.ProtoReflect.Descriptor instead. -func (*StartMacroBenchmarkResponse) Descriptor() ([]byte, []int) { - return file_macro_benchmark_proto_rawDescGZIP(), []int{1} -} - -type GetMacroBenchmarkRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *GetMacroBenchmarkRequest) Reset() { - *x = GetMacroBenchmarkRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_macro_benchmark_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetMacroBenchmarkRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetMacroBenchmarkRequest) ProtoMessage() {} - -func (x *GetMacroBenchmarkRequest) ProtoReflect() protoreflect.Message { - mi := &file_macro_benchmark_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetMacroBenchmarkRequest.ProtoReflect.Descriptor instead. -func (*GetMacroBenchmarkRequest) Descriptor() ([]byte, []int) { - return file_macro_benchmark_proto_rawDescGZIP(), []int{2} -} - -type GetMacroBenchmarkResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *GetMacroBenchmarkResponse) Reset() { - *x = GetMacroBenchmarkResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_macro_benchmark_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetMacroBenchmarkResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetMacroBenchmarkResponse) ProtoMessage() {} - -func (x *GetMacroBenchmarkResponse) ProtoReflect() protoreflect.Message { - mi := &file_macro_benchmark_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetMacroBenchmarkResponse.ProtoReflect.Descriptor instead. -func (*GetMacroBenchmarkResponse) Descriptor() ([]byte, []int) { - return file_macro_benchmark_proto_rawDescGZIP(), []int{3} -} - -type ListMacroBenchmarksResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ListMacroBenchmarksResponse) Reset() { - *x = ListMacroBenchmarksResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_macro_benchmark_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListMacroBenchmarksResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListMacroBenchmarksResponse) ProtoMessage() {} - -func (x *ListMacroBenchmarksResponse) ProtoReflect() protoreflect.Message { - mi := &file_macro_benchmark_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListMacroBenchmarksResponse.ProtoReflect.Descriptor instead. -func (*ListMacroBenchmarksResponse) Descriptor() ([]byte, []int) { - return file_macro_benchmark_proto_rawDescGZIP(), []int{4} -} - -type StatusResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *StatusResponse) Reset() { - *x = StatusResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_macro_benchmark_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StatusResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StatusResponse) ProtoMessage() {} - -func (x *StatusResponse) ProtoReflect() protoreflect.Message { - mi := &file_macro_benchmark_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead. -func (*StatusResponse) Descriptor() ([]byte, []int) { - return file_macro_benchmark_proto_rawDescGZIP(), []int{5} -} - -var File_macro_benchmark_proto protoreflect.FileDescriptor - -var file_macro_benchmark_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x6d, 0x61, 0x63, 0x72, 0x6f, 0x5f, 0x62, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, - 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x62, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, - 0x72, 0x6b, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x1c, 0x0a, 0x1a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4d, 0x61, 0x63, 0x72, 0x6f, 0x42, 0x65, 0x6e, - 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1d, 0x0a, - 0x1b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4d, 0x61, 0x63, 0x72, 0x6f, 0x42, 0x65, 0x6e, 0x63, 0x68, - 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x0a, 0x18, - 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x72, 0x6f, 0x42, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, - 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1b, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x4d, - 0x61, 0x63, 0x72, 0x6f, 0x42, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x0a, 0x1b, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x63, - 0x72, 0x6f, 0x42, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xef, 0x02, 0x0a, 0x09, 0x42, 0x65, 0x6e, 0x63, 0x68, - 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x68, 0x0a, 0x13, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4d, 0x61, 0x63, - 0x72, 0x6f, 0x42, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x12, 0x25, 0x2e, 0x62, 0x65, - 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x4d, 0x61, 0x63, - 0x72, 0x6f, 0x42, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x62, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x2e, 0x53, - 0x74, 0x61, 0x72, 0x74, 0x4d, 0x61, 0x63, 0x72, 0x6f, 0x42, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, - 0x72, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x60, - 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x72, 0x6f, 0x42, 0x65, 0x6e, 0x63, 0x68, 0x6d, - 0x61, 0x72, 0x6b, 0x12, 0x23, 0x2e, 0x62, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x2e, - 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x72, 0x6f, 0x42, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, - 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x62, 0x65, 0x6e, 0x63, 0x68, - 0x6d, 0x61, 0x72, 0x6b, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x72, 0x6f, 0x42, 0x65, 0x6e, - 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x57, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x63, 0x72, 0x6f, 0x42, 0x65, 0x6e, - 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, - 0x26, 0x2e, 0x62, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x4d, 0x61, 0x63, 0x72, 0x6f, 0x42, 0x65, 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x06, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x19, 0x2e, 0x62, 0x65, - 0x6e, 0x63, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x37, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x66, 0x6c, 0x6f, 0x77, 0x2f, 0x66, 0x6c, - 0x6f, 0x77, 0x2d, 0x67, 0x6f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2f, 0x62, 0x65, 0x63, 0x6e, 0x68, 0x6d, 0x61, 0x72, 0x6b, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_macro_benchmark_proto_rawDescOnce sync.Once - file_macro_benchmark_proto_rawDescData = file_macro_benchmark_proto_rawDesc -) - -func file_macro_benchmark_proto_rawDescGZIP() []byte { - file_macro_benchmark_proto_rawDescOnce.Do(func() { - file_macro_benchmark_proto_rawDescData = protoimpl.X.CompressGZIP(file_macro_benchmark_proto_rawDescData) - }) - return file_macro_benchmark_proto_rawDescData -} - -var file_macro_benchmark_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_macro_benchmark_proto_goTypes = []interface{}{ - (*StartMacroBenchmarkRequest)(nil), // 0: benchmark.StartMacroBenchmarkRequest - (*StartMacroBenchmarkResponse)(nil), // 1: benchmark.StartMacroBenchmarkResponse - (*GetMacroBenchmarkRequest)(nil), // 2: benchmark.GetMacroBenchmarkRequest - (*GetMacroBenchmarkResponse)(nil), // 3: benchmark.GetMacroBenchmarkResponse - (*ListMacroBenchmarksResponse)(nil), // 4: benchmark.ListMacroBenchmarksResponse - (*StatusResponse)(nil), // 5: benchmark.StatusResponse - (*emptypb.Empty)(nil), // 6: google.protobuf.Empty -} -var file_macro_benchmark_proto_depIdxs = []int32{ - 0, // 0: benchmark.Benchmark.StartMacroBenchmark:input_type -> benchmark.StartMacroBenchmarkRequest - 2, // 1: benchmark.Benchmark.GetMacroBenchmark:input_type -> benchmark.GetMacroBenchmarkRequest - 6, // 2: benchmark.Benchmark.ListMacroBenchmarks:input_type -> google.protobuf.Empty - 6, // 3: benchmark.Benchmark.Status:input_type -> google.protobuf.Empty - 1, // 4: benchmark.Benchmark.StartMacroBenchmark:output_type -> benchmark.StartMacroBenchmarkResponse - 3, // 5: benchmark.Benchmark.GetMacroBenchmark:output_type -> benchmark.GetMacroBenchmarkResponse - 4, // 6: benchmark.Benchmark.ListMacroBenchmarks:output_type -> benchmark.ListMacroBenchmarksResponse - 5, // 7: benchmark.Benchmark.Status:output_type -> benchmark.StatusResponse - 4, // [4:8] is the sub-list for method output_type - 0, // [0:4] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_macro_benchmark_proto_init() } -func file_macro_benchmark_proto_init() { - if File_macro_benchmark_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_macro_benchmark_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StartMacroBenchmarkRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_macro_benchmark_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StartMacroBenchmarkResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_macro_benchmark_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMacroBenchmarkRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_macro_benchmark_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMacroBenchmarkResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_macro_benchmark_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListMacroBenchmarksResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_macro_benchmark_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StatusResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_macro_benchmark_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_macro_benchmark_proto_goTypes, - DependencyIndexes: file_macro_benchmark_proto_depIdxs, - MessageInfos: file_macro_benchmark_proto_msgTypes, - }.Build() - File_macro_benchmark_proto = out.File - file_macro_benchmark_proto_rawDesc = nil - file_macro_benchmark_proto_goTypes = nil - file_macro_benchmark_proto_depIdxs = nil -} diff --git a/integration/benchmark/proto/macro_benchmark.proto b/integration/benchmark/proto/macro_benchmark.proto deleted file mode 100644 index e461ea81892..00000000000 --- a/integration/benchmark/proto/macro_benchmark.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; - -package benchmark; -option go_package = "github.com/onflow/flow-go/integration/becnhmark/proto"; - -import "google/protobuf/empty.proto"; - -message StartMacroBenchmarkRequest {} -message StartMacroBenchmarkResponse {} - -message GetMacroBenchmarkRequest {} -message GetMacroBenchmarkResponse {} - -message ListMacroBenchmarksResponse {} - -message StatusResponse {} - -service Benchmark { - rpc StartMacroBenchmark(StartMacroBenchmarkRequest) - returns (stream StartMacroBenchmarkResponse) {} - rpc GetMacroBenchmark(GetMacroBenchmarkRequest) - returns (GetMacroBenchmarkResponse) {} - rpc ListMacroBenchmarks(google.protobuf.Empty) - returns (ListMacroBenchmarksResponse) {} - - rpc Status(google.protobuf.Empty) returns (StatusResponse) {} -} - diff --git a/integration/benchmark/proto/macro_benchmark_grpc.pb.go b/integration/benchmark/proto/macro_benchmark_grpc.pb.go deleted file mode 100644 index 065a26fcb39..00000000000 --- a/integration/benchmark/proto/macro_benchmark_grpc.pb.go +++ /dev/null @@ -1,243 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.21.9 -// source: macro_benchmark.proto - -package proto - -import ( - context "context" - - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - emptypb "google.golang.org/protobuf/types/known/emptypb" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// BenchmarkClient is the client API for Benchmark service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type BenchmarkClient interface { - StartMacroBenchmark(ctx context.Context, in *StartMacroBenchmarkRequest, opts ...grpc.CallOption) (Benchmark_StartMacroBenchmarkClient, error) - GetMacroBenchmark(ctx context.Context, in *GetMacroBenchmarkRequest, opts ...grpc.CallOption) (*GetMacroBenchmarkResponse, error) - ListMacroBenchmarks(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListMacroBenchmarksResponse, error) - Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StatusResponse, error) -} - -type benchmarkClient struct { - cc grpc.ClientConnInterface -} - -func NewBenchmarkClient(cc grpc.ClientConnInterface) BenchmarkClient { - return &benchmarkClient{cc} -} - -func (c *benchmarkClient) StartMacroBenchmark(ctx context.Context, in *StartMacroBenchmarkRequest, opts ...grpc.CallOption) (Benchmark_StartMacroBenchmarkClient, error) { - stream, err := c.cc.NewStream(ctx, &Benchmark_ServiceDesc.Streams[0], "/benchmark.Benchmark/StartMacroBenchmark", opts...) - if err != nil { - return nil, err - } - x := &benchmarkStartMacroBenchmarkClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Benchmark_StartMacroBenchmarkClient interface { - Recv() (*StartMacroBenchmarkResponse, error) - grpc.ClientStream -} - -type benchmarkStartMacroBenchmarkClient struct { - grpc.ClientStream -} - -func (x *benchmarkStartMacroBenchmarkClient) Recv() (*StartMacroBenchmarkResponse, error) { - m := new(StartMacroBenchmarkResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *benchmarkClient) GetMacroBenchmark(ctx context.Context, in *GetMacroBenchmarkRequest, opts ...grpc.CallOption) (*GetMacroBenchmarkResponse, error) { - out := new(GetMacroBenchmarkResponse) - err := c.cc.Invoke(ctx, "/benchmark.Benchmark/GetMacroBenchmark", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *benchmarkClient) ListMacroBenchmarks(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ListMacroBenchmarksResponse, error) { - out := new(ListMacroBenchmarksResponse) - err := c.cc.Invoke(ctx, "/benchmark.Benchmark/ListMacroBenchmarks", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *benchmarkClient) Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*StatusResponse, error) { - out := new(StatusResponse) - err := c.cc.Invoke(ctx, "/benchmark.Benchmark/Status", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// BenchmarkServer is the server API for Benchmark service. -// All implementations must embed UnimplementedBenchmarkServer -// for forward compatibility -type BenchmarkServer interface { - StartMacroBenchmark(*StartMacroBenchmarkRequest, Benchmark_StartMacroBenchmarkServer) error - GetMacroBenchmark(context.Context, *GetMacroBenchmarkRequest) (*GetMacroBenchmarkResponse, error) - ListMacroBenchmarks(context.Context, *emptypb.Empty) (*ListMacroBenchmarksResponse, error) - Status(context.Context, *emptypb.Empty) (*StatusResponse, error) - mustEmbedUnimplementedBenchmarkServer() -} - -// UnimplementedBenchmarkServer must be embedded to have forward compatible implementations. -type UnimplementedBenchmarkServer struct { -} - -func (UnimplementedBenchmarkServer) StartMacroBenchmark(*StartMacroBenchmarkRequest, Benchmark_StartMacroBenchmarkServer) error { - return status.Errorf(codes.Unimplemented, "method StartMacroBenchmark not implemented") -} -func (UnimplementedBenchmarkServer) GetMacroBenchmark(context.Context, *GetMacroBenchmarkRequest) (*GetMacroBenchmarkResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetMacroBenchmark not implemented") -} -func (UnimplementedBenchmarkServer) ListMacroBenchmarks(context.Context, *emptypb.Empty) (*ListMacroBenchmarksResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListMacroBenchmarks not implemented") -} -func (UnimplementedBenchmarkServer) Status(context.Context, *emptypb.Empty) (*StatusResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") -} -func (UnimplementedBenchmarkServer) mustEmbedUnimplementedBenchmarkServer() {} - -// UnsafeBenchmarkServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to BenchmarkServer will -// result in compilation errors. -type UnsafeBenchmarkServer interface { - mustEmbedUnimplementedBenchmarkServer() -} - -func RegisterBenchmarkServer(s grpc.ServiceRegistrar, srv BenchmarkServer) { - s.RegisterService(&Benchmark_ServiceDesc, srv) -} - -func _Benchmark_StartMacroBenchmark_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(StartMacroBenchmarkRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(BenchmarkServer).StartMacroBenchmark(m, &benchmarkStartMacroBenchmarkServer{stream}) -} - -type Benchmark_StartMacroBenchmarkServer interface { - Send(*StartMacroBenchmarkResponse) error - grpc.ServerStream -} - -type benchmarkStartMacroBenchmarkServer struct { - grpc.ServerStream -} - -func (x *benchmarkStartMacroBenchmarkServer) Send(m *StartMacroBenchmarkResponse) error { - return x.ServerStream.SendMsg(m) -} - -func _Benchmark_GetMacroBenchmark_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetMacroBenchmarkRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BenchmarkServer).GetMacroBenchmark(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/benchmark.Benchmark/GetMacroBenchmark", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BenchmarkServer).GetMacroBenchmark(ctx, req.(*GetMacroBenchmarkRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Benchmark_ListMacroBenchmarks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BenchmarkServer).ListMacroBenchmarks(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/benchmark.Benchmark/ListMacroBenchmarks", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BenchmarkServer).ListMacroBenchmarks(ctx, req.(*emptypb.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Benchmark_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(emptypb.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BenchmarkServer).Status(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/benchmark.Benchmark/Status", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BenchmarkServer).Status(ctx, req.(*emptypb.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -// Benchmark_ServiceDesc is the grpc.ServiceDesc for Benchmark service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Benchmark_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "benchmark.Benchmark", - HandlerType: (*BenchmarkServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetMacroBenchmark", - Handler: _Benchmark_GetMacroBenchmark_Handler, - }, - { - MethodName: "ListMacroBenchmarks", - Handler: _Benchmark_ListMacroBenchmarks_Handler, - }, - { - MethodName: "Status", - Handler: _Benchmark_Status_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "StartMacroBenchmark", - Handler: _Benchmark_StartMacroBenchmark_Handler, - ServerStreams: true, - }, - }, - Metadata: "macro_benchmark.proto", -} diff --git a/integration/benchmark/server/bench.sh b/integration/benchmark/server/bench.sh index 778cac6279d..d4859c18dc0 100755 --- a/integration/benchmark/server/bench.sh +++ b/integration/benchmark/server/bench.sh @@ -7,7 +7,7 @@ set -o pipefail # this will keep the TPS automation code separate from the code that's being tested so we won't run into issues # of having old versions of automation code just because we happen to be testing an older version flow-go git clone https://github.com/onflow/flow-go.git -cd flow-go/integration/localnet +cd flow-go/integration/localnet || exit git fetch git fetch --tags @@ -37,7 +37,7 @@ while read -r input; do # sleep is workaround for slow initialization of some node types, so that benchmark does not quit immediately with "connection refused" sleep 30; - go run ../benchmark/cmd/ci -log-level debug -git-repo-path ../../ -tps-initial 800 -tps-min 1 -tps-max 1200 -duration 30m -load-type "$load" + go run ../benchmark/cmd/ci -log-level info -git-repo-path ../../ -tps-initial 800 -tps-min 1 -tps-max 1200 -duration 30m -load-type "$load" # instead of running "make stop" which uses docker-compose for a lot of older versions, # we explicitly run the command here with "docker compose" diff --git a/integration/benchmark/server/branches.recent b/integration/benchmark/server/branches.recent deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/integration/benchmark/server/commits.recent b/integration/benchmark/server/commits.recent deleted file mode 100644 index 538b5965dcc..00000000000 --- a/integration/benchmark/server/commits.recent +++ /dev/null @@ -1 +0,0 @@ -janez/tps-benchmark-evm-load:894151a2390b11e3d9a399b41746d1c112f745fa:evm diff --git a/integration/benchmark/server/flow-go b/integration/benchmark/server/flow-go deleted file mode 160000 index 894151a2390..00000000000 --- a/integration/benchmark/server/flow-go +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 894151a2390b11e3d9a399b41746d1c112f745fa diff --git a/integration/benchmark/server/load-config.yml b/integration/benchmark/server/load-config.yml new file mode 100644 index 00000000000..e22b4dc0cc4 --- /dev/null +++ b/integration/benchmark/server/load-config.yml @@ -0,0 +1,12 @@ +- token-transfer: + load_type: token-transfer + tps_initial: 800 +- create-account: + load_type: create-account + tps_initial: 600 +- ledger-heavy: + load_type: ledger-heavy + tps_initial: 3 +- evm-transfer: + load_type: evm-transfer + tps_initial: 500 diff --git a/integration/benchmark/worker_stats_tracker.go b/integration/benchmark/worker_stats_tracker.go index d2a0f60f92e..cd582a2c2bf 100644 --- a/integration/benchmark/worker_stats_tracker.go +++ b/integration/benchmark/worker_stats_tracker.go @@ -133,7 +133,7 @@ func NewPeriodicStatsLogger( w := NewWorker( ctx, 0, - 1*time.Second, + 3*time.Second, func(workerID int) { stats := st.GetStats() log.Info(). diff --git a/integration/go.mod b/integration/go.mod index 439d4aaceed..35288bd997c 100644 --- a/integration/go.mod +++ b/integration/go.mod @@ -42,6 +42,7 @@ require ( golang.org/x/sync v0.6.0 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 + gopkg.in/yaml.v3 v3.0.1 ) require ( @@ -348,7 +349,6 @@ require ( google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect modernc.org/libc v1.22.3 // indirect modernc.org/mathutil v1.5.0 // indirect From 0e639e5a0d467ba77c6d6f7303bb5d8ff099f342 Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Thu, 14 Mar 2024 18:46:51 +0100 Subject: [PATCH 02/11] add load config to bench.sh --- integration/benchmark/cmd/ci/main.go | 2 +- integration/benchmark/server/bench.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/benchmark/cmd/ci/main.go b/integration/benchmark/cmd/ci/main.go index 1058f4d5541..08cff5eb57c 100644 --- a/integration/benchmark/cmd/ci/main.go +++ b/integration/benchmark/cmd/ci/main.go @@ -55,7 +55,7 @@ func main() { maxTPSFlag := flag.Int("tps-max", *initialTPSFlag, "maximum transactions per second allowed") minTPSFlag := flag.Int("tps-min", *initialTPSFlag, "minimum transactions per second allowed") loadTypeFlag := flag.String("load-type", string(defaultLoadType), "load type (token-transfer / const-exec / evm from the load config file)") - loadConfigFileLocationFlag := flag.String("load-config-file", "", "load config file location. If not provided, default config will be used.") + loadConfigFileLocationFlag := flag.String("load-config", "", "load config file location. If not provided, default config will be used.") adjustIntervalFlag := flag.Duration("tps-adjust-interval", defaultAdjustInterval, "interval for adjusting TPS") adjustDelayFlag := flag.Duration("tps-adjust-delay", 120*time.Second, "delay before adjusting TPS") diff --git a/integration/benchmark/server/bench.sh b/integration/benchmark/server/bench.sh index d4859c18dc0..f2bd6dbec60 100755 --- a/integration/benchmark/server/bench.sh +++ b/integration/benchmark/server/bench.sh @@ -37,7 +37,7 @@ while read -r input; do # sleep is workaround for slow initialization of some node types, so that benchmark does not quit immediately with "connection refused" sleep 30; - go run ../benchmark/cmd/ci -log-level info -git-repo-path ../../ -tps-initial 800 -tps-min 1 -tps-max 1200 -duration 30m -load-type "$load" + go run ../benchmark/cmd/ci -log-level info -git-repo-path ../../ -tps-initial 800 -tps-min 1 -tps-max 1200 -duration 30m -load-type "$load" -load-config "load-config.yml" # instead of running "make stop" which uses docker-compose for a lot of older versions, # we explicitly run the command here with "docker compose" From f60cf9b889d565264a0ce4db9e07bc000ca4278e Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Thu, 14 Mar 2024 19:05:24 +0100 Subject: [PATCH 03/11] change control for testing --- integration/benchmark/server/control.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/integration/benchmark/server/control.sh b/integration/benchmark/server/control.sh index 26ecad5a289..02bebb100aa 100755 --- a/integration/benchmark/server/control.sh +++ b/integration/benchmark/server/control.sh @@ -21,7 +21,8 @@ commits_file="/opt/commits.recent" load_types=("token-transfer" "create-account" "ledger-heavy" "evm-transfer") # get the merge commits from the last week from master ordered by author date -for commit in $(git log --merges --first-parent --format="%S:%H" origin/master --since '1 week' --author-date-order ) +# TEMPORARY: DO NOT MERGE!! +for commit in $(git log --first-parent --format="%S:%H" origin/janez/improve-tps-metering --since '1 week' --author-date-order | head -1) do for load in "${load_types[@]}" do From 696f35b686b6cb1dfcba3bc5858462bd8cb48b5f Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Thu, 14 Mar 2024 19:11:01 +0100 Subject: [PATCH 04/11] change load-config location --- integration/benchmark/server/bench.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/benchmark/server/bench.sh b/integration/benchmark/server/bench.sh index f2bd6dbec60..161549aba0f 100755 --- a/integration/benchmark/server/bench.sh +++ b/integration/benchmark/server/bench.sh @@ -37,7 +37,7 @@ while read -r input; do # sleep is workaround for slow initialization of some node types, so that benchmark does not quit immediately with "connection refused" sleep 30; - go run ../benchmark/cmd/ci -log-level info -git-repo-path ../../ -tps-initial 800 -tps-min 1 -tps-max 1200 -duration 30m -load-type "$load" -load-config "load-config.yml" + go run ../benchmark/cmd/ci -log-level info -git-repo-path ../../ -tps-initial 800 -tps-min 1 -tps-max 1200 -duration 30m -load-type "$load" -load-config "../benchmark/server/load-config.yml" # instead of running "make stop" which uses docker-compose for a lot of older versions, # we explicitly run the command here with "docker compose" From 7adb2f49619dfafe8f446722dd434666bb15c6f9 Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Thu, 14 Mar 2024 19:36:48 +0100 Subject: [PATCH 05/11] fix yaml --- integration/benchmark/server/load-config.yml | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/integration/benchmark/server/load-config.yml b/integration/benchmark/server/load-config.yml index e22b4dc0cc4..8b81ca20cdc 100644 --- a/integration/benchmark/server/load-config.yml +++ b/integration/benchmark/server/load-config.yml @@ -1,12 +1,12 @@ -- token-transfer: - load_type: token-transfer - tps_initial: 800 -- create-account: - load_type: create-account - tps_initial: 600 -- ledger-heavy: - load_type: ledger-heavy - tps_initial: 3 -- evm-transfer: - load_type: evm-transfer - tps_initial: 500 +token-transfer: + load_type: token-transfer + tps_initial: 800 +create-account: + load_type: create-account + tps_initial: 600 +ledger-heavy: + load_type: ledger-heavy + tps_initial: 3 +evm-transfer: + load_type: evm-transfer + tps_initial: 500 From eead0551db198d70d49b5f912f323fab0a90e92f Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Thu, 14 Mar 2024 19:53:12 +0100 Subject: [PATCH 06/11] default values for load-config --- integration/benchmark/contLoadGenerator.go | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/integration/benchmark/contLoadGenerator.go b/integration/benchmark/contLoadGenerator.go index 41081de7163..7ca9586e8bd 100644 --- a/integration/benchmark/contLoadGenerator.go +++ b/integration/benchmark/contLoadGenerator.go @@ -8,6 +8,7 @@ import ( "time" "github.com/rs/zerolog" + "gopkg.in/yaml.v3" flowsdk "github.com/onflow/flow-go-sdk" "github.com/onflow/flow-go-sdk/access" @@ -52,11 +53,29 @@ type LoadConfig struct { // load type is used to run multiple loads with different parameters. LoadName string `yaml:"-"` LoadType string `yaml:"load_type"` - TpsMax int `default:"1200" yaml:"tps_max"` - TpsMin int `default:"1" yaml:"tps_min"` + TpsMax int `yaml:"tps_max"` + TpsMin int `yaml:"tps_min"` TPSInitial int `yaml:"tps_initial"` } +func DefaultLoadConfig() LoadConfig { + return LoadConfig{ + TpsMax: 1200, + TpsMin: 1, + } +} + +func (s *LoadConfig) UnmarshalYAML(value *yaml.Node) error { + config := DefaultLoadConfig() + + if err := value.Decode(&config); err != nil { + return err + } + + *s = config + return nil +} + type LoadParams struct { NumberOfAccounts int LoadConfig LoadConfig From d844232bf6f5ad13dede2ebe20155835df7d3437 Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Thu, 14 Mar 2024 20:00:57 +0100 Subject: [PATCH 07/11] dont use defaults --- integration/benchmark/contLoadGenerator.go | 22 +------------------- integration/benchmark/server/load-config.yml | 8 +++++++ 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/integration/benchmark/contLoadGenerator.go b/integration/benchmark/contLoadGenerator.go index 7ca9586e8bd..eb0032814ae 100644 --- a/integration/benchmark/contLoadGenerator.go +++ b/integration/benchmark/contLoadGenerator.go @@ -7,9 +7,6 @@ import ( "sync" "time" - "github.com/rs/zerolog" - "gopkg.in/yaml.v3" - flowsdk "github.com/onflow/flow-go-sdk" "github.com/onflow/flow-go-sdk/access" "github.com/onflow/flow-go-sdk/crypto" @@ -20,6 +17,7 @@ import ( "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/module/metrics" "github.com/onflow/flow-go/utils/unittest" + "github.com/rs/zerolog" ) const lostTransactionThreshold = 180 * time.Second @@ -58,24 +56,6 @@ type LoadConfig struct { TPSInitial int `yaml:"tps_initial"` } -func DefaultLoadConfig() LoadConfig { - return LoadConfig{ - TpsMax: 1200, - TpsMin: 1, - } -} - -func (s *LoadConfig) UnmarshalYAML(value *yaml.Node) error { - config := DefaultLoadConfig() - - if err := value.Decode(&config); err != nil { - return err - } - - *s = config - return nil -} - type LoadParams struct { NumberOfAccounts int LoadConfig LoadConfig diff --git a/integration/benchmark/server/load-config.yml b/integration/benchmark/server/load-config.yml index 8b81ca20cdc..f7c62d31729 100644 --- a/integration/benchmark/server/load-config.yml +++ b/integration/benchmark/server/load-config.yml @@ -1,12 +1,20 @@ token-transfer: load_type: token-transfer tps_initial: 800 + tps_min: 1 + tps_max: 1200 create-account: load_type: create-account tps_initial: 600 + tps_min: 1 + tps_max: 1200 ledger-heavy: load_type: ledger-heavy tps_initial: 3 + tps_min: 1 + tps_max: 1200 evm-transfer: load_type: evm-transfer tps_initial: 500 + tps_min: 1 + tps_max: 1200 From b897862fe6ce420df20a3bb3e6da494f2b6820b9 Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Fri, 15 Mar 2024 12:59:29 +0100 Subject: [PATCH 08/11] fix build and lint --- integration/benchmark/cmd/ci/main.go | 6 ++---- integration/benchmark/cmd/manual/main.go | 12 ++++++++---- integration/benchmark/contLoadGenerator.go | 3 ++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/integration/benchmark/cmd/ci/main.go b/integration/benchmark/cmd/ci/main.go index 08cff5eb57c..4db99ae21cd 100644 --- a/integration/benchmark/cmd/ci/main.go +++ b/integration/benchmark/cmd/ci/main.go @@ -3,24 +3,22 @@ package main import ( "context" "flag" - "gopkg.in/yaml.v3" "os" "strings" "time" - "github.com/onflow/flow-go/integration/benchmark/load" - "github.com/prometheus/client_golang/prometheus" - "github.com/rs/zerolog" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + "gopkg.in/yaml.v3" flowsdk "github.com/onflow/flow-go-sdk" "github.com/onflow/flow-go-sdk/access" client "github.com/onflow/flow-go-sdk/access/grpc" "github.com/onflow/flow-go/integration/benchmark" + "github.com/onflow/flow-go/integration/benchmark/load" "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/module/metrics" "github.com/onflow/flow-go/utils/unittest" diff --git a/integration/benchmark/cmd/manual/main.go b/integration/benchmark/cmd/manual/main.go index f42e21ef894..ffaa9615570 100644 --- a/integration/benchmark/cmd/manual/main.go +++ b/integration/benchmark/cmd/manual/main.go @@ -9,8 +9,6 @@ import ( "strings" "time" - "github.com/onflow/flow-go/integration/benchmark/load" - "github.com/prometheus/client_golang/prometheus" "github.com/rs/zerolog" "google.golang.org/grpc" @@ -132,8 +130,14 @@ func main() { }, benchmark.LoadParams{ NumberOfAccounts: int(maxTPS) * *accountMultiplierFlag, - LoadType: load.LoadType(*loadTypeFlag), - FeedbackEnabled: *feedbackEnabled, + LoadConfig: benchmark.LoadConfig{ + LoadName: *loadTypeFlag, + LoadType: *loadTypeFlag, + TpsMax: int(maxTPS), + TpsMin: int(maxTPS), + TPSInitial: int(maxTPS), + }, + FeedbackEnabled: *feedbackEnabled, }, ) if err != nil { diff --git a/integration/benchmark/contLoadGenerator.go b/integration/benchmark/contLoadGenerator.go index eb0032814ae..4b5c147b8ff 100644 --- a/integration/benchmark/contLoadGenerator.go +++ b/integration/benchmark/contLoadGenerator.go @@ -7,6 +7,8 @@ import ( "sync" "time" + "github.com/rs/zerolog" + flowsdk "github.com/onflow/flow-go-sdk" "github.com/onflow/flow-go-sdk/access" "github.com/onflow/flow-go-sdk/crypto" @@ -17,7 +19,6 @@ import ( "github.com/onflow/flow-go/model/flow" "github.com/onflow/flow-go/module/metrics" "github.com/onflow/flow-go/utils/unittest" - "github.com/rs/zerolog" ) const lostTransactionThreshold = 180 * time.Second From 68592cb1507f0ebd50d44c98aadce1ba84e3f080 Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Wed, 20 Mar 2024 16:05:48 +0100 Subject: [PATCH 09/11] fix makefile --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 724f84d5ed7..7ba432f6bb6 100644 --- a/Makefile +++ b/Makefile @@ -157,7 +157,6 @@ generate-mocks: install-mock-generators mockery --name '(Connector|PingInfoProvider)' --dir=network/p2p --case=underscore --output="./network/mocknetwork" --outpkg="mocknetwork" CGO_CFLAGS=$(CRYPTO_FLAG) mockgen -destination=storage/mocks/storage.go -package=mocks github.com/onflow/flow-go/storage Blocks,Headers,Payloads,Collections,Commits,Events,ServiceEvents,TransactionResults CGO_CFLAGS=$(CRYPTO_FLAG) mockgen -destination=network/mocknetwork/mock_network.go -package=mocknetwork github.com/onflow/flow-go/network EngineRegistry - mockery --name='.*' --dir=integration/benchmark/mocksiface --case=underscore --output="integration/benchmark/mock" --outpkg="mock" mockery --name=ExecutionDataStore --dir=module/executiondatasync/execution_data --case=underscore --output="./module/executiondatasync/execution_data/mock" --outpkg="mock" mockery --name=Downloader --dir=module/executiondatasync/execution_data --case=underscore --output="./module/executiondatasync/execution_data/mock" --outpkg="mock" mockery --name '(ExecutionDataRequester|IndexReporter)' --dir=module/state_synchronization --case=underscore --output="./module/state_synchronization/mock" --outpkg="state_synchronization" From 3eff3b838e9d65020d8503c00e591abde64849a4 Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Thu, 4 Apr 2024 15:07:34 +0200 Subject: [PATCH 10/11] fix doc string --- integration/benchmark/cmd/ci/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/benchmark/cmd/ci/main.go b/integration/benchmark/cmd/ci/main.go index 4db99ae21cd..c3917f5b161 100644 --- a/integration/benchmark/cmd/ci/main.go +++ b/integration/benchmark/cmd/ci/main.go @@ -52,7 +52,7 @@ func main() { initialTPSFlag := flag.Int("tps-initial", 10, "starting transactions per second") maxTPSFlag := flag.Int("tps-max", *initialTPSFlag, "maximum transactions per second allowed") minTPSFlag := flag.Int("tps-min", *initialTPSFlag, "minimum transactions per second allowed") - loadTypeFlag := flag.String("load-type", string(defaultLoadType), "load type (token-transfer / const-exec / evm from the load config file)") + loadTypeFlag := flag.String("load-type", string(defaultLoadType), "load type (token-transfer / const-exec / evm) from the load config file") loadConfigFileLocationFlag := flag.String("load-config", "", "load config file location. If not provided, default config will be used.") adjustIntervalFlag := flag.Duration("tps-adjust-interval", defaultAdjustInterval, "interval for adjusting TPS") From fa9f719a26a3f688a32b541d70cb9dc9ee2e2cb2 Mon Sep 17 00:00:00 2001 From: Janez Podhostnik Date: Fri, 12 Apr 2024 14:28:01 +0200 Subject: [PATCH 11/11] remove temporary code --- integration/benchmark/server/control.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/integration/benchmark/server/control.sh b/integration/benchmark/server/control.sh index 02bebb100aa..26ecad5a289 100755 --- a/integration/benchmark/server/control.sh +++ b/integration/benchmark/server/control.sh @@ -21,8 +21,7 @@ commits_file="/opt/commits.recent" load_types=("token-transfer" "create-account" "ledger-heavy" "evm-transfer") # get the merge commits from the last week from master ordered by author date -# TEMPORARY: DO NOT MERGE!! -for commit in $(git log --first-parent --format="%S:%H" origin/janez/improve-tps-metering --since '1 week' --author-date-order | head -1) +for commit in $(git log --merges --first-parent --format="%S:%H" origin/master --since '1 week' --author-date-order ) do for load in "${load_types[@]}" do