Skip to content

Commit

Permalink
jsonrpc: unlimit the number of concurrent jsonrpc requests
Browse files Browse the repository at this point in the history
The jsonrpsee library is artificially limiting the number of concurrent
requests that the server can process to ~100 since its treating each
request as a separate connection. In order to work around this we can
just set the maximum number of connections for the jsonrpsee service to
a high number since its not actually controlling the number of
connections.
  • Loading branch information
bmwill committed Jan 30, 2025
1 parent 3e3fd49 commit b0e76cc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/sui-json-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,13 @@ impl JsonRpcServerBuilder {
let rpc_middleware = jsonrpsee::server::middleware::rpc::RpcServiceBuilder::new()
.layer_fn(move |s| MetricsLayer::new(s, metrics.clone()))
.layer_fn(move |s| TrafficControllerService::new(s, traffic_controller.clone()));
let service_builder =
jsonrpsee::server::ServerBuilder::new().set_rpc_middleware(rpc_middleware);
let service_builder = jsonrpsee::server::ServerBuilder::new()
// Since we're not using jsonrpsee's server to actually handle connections this value
// is instead limiting the number of concurrent requests and has no impact on the
// number of connections. As such, for now we can just set this to a very high value to
// disable it artificially limiting us to ~100 conncurrent requests.
.max_connections(u32::MAX)
.set_rpc_middleware(rpc_middleware);

let mut router = axum::Router::new();
match server_type {
Expand Down

0 comments on commit b0e76cc

Please sign in to comment.