From dcfad0c1b5a7a485144b9a176e688c19d044e18e Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 17 May 2022 17:24:10 +0000 Subject: [PATCH] max fd limit --- Cargo.lock | 10 ++++++++++ web3-proxy/Cargo.toml | 1 + web3-proxy/src/main.rs | 2 ++ 3 files changed, 13 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index b796a8e9..1988a8e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1387,6 +1387,15 @@ dependencies = [ "instant", ] +[[package]] +name = "fdlimit" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4c9e43643f5a3be4ca5b67d26b98031ff9db6806c3440ae32e02e3ceac3f1b" +dependencies = [ + "libc", +] + [[package]] name = "ff" version = "0.11.1" @@ -4294,6 +4303,7 @@ dependencies = [ "dashmap", "derive_more", "ethers", + "fdlimit", "flume", "futures", "governor", diff --git a/web3-proxy/Cargo.toml b/web3-proxy/Cargo.toml index 5f436ed8..a111441a 100644 --- a/web3-proxy/Cargo.toml +++ b/web3-proxy/Cargo.toml @@ -13,6 +13,7 @@ console-subscriber = { version = "0.1.5", features = ["parking_lot"] } dashmap = "5.3.3" derive_more = "0.99.17" ethers = { git = "https://github.com/gakonst/ethers-rs", features = ["rustls", "ws"] } +fdlimit = "0.2.1" flume = "0.10.12" futures = { version = "0.3.21", features = ["thread-pool"] } # TODO: governor has a "futures" and "futures-timer" feature. do we want those? diff --git a/web3-proxy/src/main.rs b/web3-proxy/src/main.rs index 9ffc1978..a5a5d4ca 100644 --- a/web3-proxy/src/main.rs +++ b/web3-proxy/src/main.rs @@ -25,6 +25,8 @@ fn main() -> anyhow::Result<()> { // TODO: if RUST_LOG isn't set, set it to "web3_proxy=debug" or something console_subscriber::init(); + fdlimit::raise_fd_limit(); + let cli_config: CliConfig = argh::from_env(); info!("Loading rpc config @ {}", cli_config.rpc_config_path);