From ab75b74de33a64814097282d894b3b2c95e221fd Mon Sep 17 00:00:00 2001 From: colindickson Date: Thu, 22 Feb 2024 11:14:39 -0500 Subject: [PATCH] add flag to set maximum concurrent requests on a tier2 instance --- CHANGELOG.md | 4 ++++ cmd/apps/substreams_tier2.go | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4edba2..8179b97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Operators, you should copy/paste content of this content straight to your projec If you were at `firehose-core` version `1.0.0` and are bumping to `1.1.0`, you should copy the content between those 2 version to your own repository, replacing placeholder value `fire{chain}` with your chain's own binary. +## Unreleased + +* Added `--substreams-tier2-max-concurrent-requests` to limit the number of concurrent requests to the tier2 substreams service. + ## v1.2.4 ### Substreams improvements diff --git a/cmd/apps/substreams_tier2.go b/cmd/apps/substreams_tier2.go index b8950bf..21f2e8b 100644 --- a/cmd/apps/substreams_tier2.go +++ b/cmd/apps/substreams_tier2.go @@ -42,6 +42,7 @@ func RegisterSubstreamsTier2App[B firecore.Block](chain *firecore.Chain[B], root RegisterFlags: func(cmd *cobra.Command) error { cmd.Flags().String("substreams-tier2-grpc-listen-addr", firecore.SubstreamsTier2GRPCServingAddr, "Address on which the substreams tier2 will listen. Default is plain-text, appending a '*' to the end to jkkkj") cmd.Flags().String("substreams-tier2-discovery-service-url", "", "URL to advertise presence to the grpc discovery service") //traffic-director://xds?vpc_network=vpc-global&use_xds_reds=true + cmd.Flags().Uint64("substreams-tier2-max-concurrent-requests", 0, "Maximum number of concurrent requests allowed on the server. When the tier2 service hits this limit, it will set itself as 'Not Ready' until requests are processed. Default 0 (no limit)") // all substreams registerCommonSubstreamsFlags(cmd) @@ -64,6 +65,8 @@ func RegisterSubstreamsTier2App[B firecore.Block](chain *firecore.Chain[B], root stateBundleSize := viper.GetUint64("substreams-state-bundle-size") + maximumConcurrentRequests := viper.GetUint64("substreams-tier2-max-concurrent-requests") + tracing := os.Getenv("SUBSTREAMS_TRACING") == "modules_exec" var serviceDiscoveryURL *url.URL @@ -98,6 +101,8 @@ func RegisterSubstreamsTier2App[B firecore.Block](chain *firecore.Chain[B], root GRPCListenAddr: grpcListenAddr, ServiceDiscoveryURL: serviceDiscoveryURL, + + MaximumConcurrentRequests: maximumConcurrentRequests, }, &app.Tier2Modules{ CheckPendingShutDown: runtime.IsPendingShutdown, }), nil