You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EnforceCompressionbool// refuse incoming requests that do not accept gzip compression (ConnectRPC or GRPC)
58
+
StateStoreURLstring
59
+
StateStoreDefaultTagstring
60
+
BlockTypestring
61
+
StateBundleSizeuint64
62
+
EnforceCompressionbool// refuse incoming requests that do not accept gzip compression (ConnectRPC or GRPC)
63
+
ActiveRequestsSoftLimitint// maximum number of active requests a tier1 app can have with external clients before starting to advertise itself as unready in the health check
64
+
ActiveRequestsHardLimitint// maximum number of active requests a tier1 app can have with external clients, refuse with CodeUnavailable if reached
64
65
65
66
MaxSubrequestsuint64
66
67
SubrequestsEndpointstring
@@ -199,9 +200,12 @@ func (a *Tier1App) Run() error {
199
200
a.config.MaxSubrequests,
200
201
a.config.StateBundleSize,
201
202
a.config.BlockType,
203
+
a.setIsReady,
202
204
subrequestsClientConfig,
203
205
tier2RequestParameters,
204
206
a.config.EnforceCompression,
207
+
a.config.ActiveRequestsSoftLimit,
208
+
a.config.ActiveRequestsHardLimit,
205
209
opts...,
206
210
)
207
211
iferr!=nil {
@@ -230,14 +234,14 @@ func (a *Tier1App) Run() error {
230
234
a.logger.Info("waiting until hub is real-time synced")
Copy file name to clipboardExpand all lines: docs/release-notes/change-log.md
+1
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
17
17
* Fix detection of accepted gzip compression when multiple values are sent in the `Grpc-Accept-Encoding` header (ex: Python library)
18
18
* Properly accept and compress responses with `gzip` for browser HTTP clients using ConnectWeb with `Accept-Encoding` header
19
19
* Allow setting subscription channel max capacity via `SOURCE_CHAN_SIZE` env var (default: 100)
20
+
* Added tier1 app configuration option to limit max active requests a single instance can accept before starting to reject them with 'Unavailable' gRPC code.
@@ -218,7 +227,7 @@ func (s *Tier1Service) Blocks(
218
227
compressed=true
219
228
}
220
229
ifs.enforceCompression&&!compressed {
221
-
returnconnect.NewError(connect.CodeInvalidArgument, fmt.Errorf("Your client does not accept gzip- or zstd-compressed streams. Check how to enable it on your GRPC or ConnectRPC client"))
230
+
returnconnect.NewError(connect.CodeInvalidArgument, fmt.Errorf("your client does not accept gzip- or zstd-compressed streams. Check how to enable it on your gRPC or ConnectRPC client"))
222
231
}
223
232
224
233
request:=req.Msg
@@ -284,10 +293,28 @@ func (s *Tier1Service) Blocks(
284
293
}
285
294
}
286
295
296
+
status:=s.getOverloadedStatus()
297
+
298
+
// Set us as unready if the soft limit would be reached by this request
299
+
ifstatus.softLimitWouldBeReached() {
300
+
s.appSetIsReadyState(false)
301
+
}
302
+
303
+
// Refuse the request if the hard limit is currently reached by this instance
304
+
ifstatus.hardLimitReached() {
305
+
returnconnect.NewError(connect.CodeUnavailable, fmt.Errorf("service is currently not accepting new requests, re-connect back right away to be balanced to a non-full node"))
0 commit comments