-
Notifications
You must be signed in to change notification settings - Fork 851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set a default limit to the connections undici
can open
#2726
Comments
undici
can openundici
can open
Very nice you fixed all my issues I was having when subscribing to a load of accounts on program startup... I use this
|
I wrote benchmarks to find this number!
So at least in my testing:
@WilfredAlmeida, can you download that benchmark suite, add in some tests (connections down to 1, above 64, and add in some wider pipelines) and run them against Triton servers? I'd do it but I'm pretty sure I've already been blocklisted on Mainnet. |
Finally got a clean test run for 1 and 128 connections.
|
Sounds good to me It'd be better if we could have it mentioned in the web3.js docs something like "If you're facing socket issues, based on your RPC provider, check this out" We already have the doc published here |
At Triton One, we have observed our customers face socket/connection issues. More information here
These issues have been there for more than 2 years.
tl;dr of the issues is that NodeJS tries to open infinite connections with the server and hits a limit and existing connections break and new connection attempts time out. In our tests, NodeJS opened over 16,000 connections. Opening new connection is unnecessary since existing ones can be resued. This is not the case with the Bun runtime. It opens less than 400 connections and doesn't error out at all.
With the current versions of web3.js (latest 1.91.8 as of this writing) the issues are frequent. We've also tested with the new web3.js
2.0.0-preview.3
and the error rate is less, but it still does exist.The fix for these issues, as mentioned in the doc shared above, is to limit the number of connections NodeJS can open. This can be configured with the
http.Agent
configurations.We propose that Web3JS should have a default configurable connection limit like the following:
From the
http.Agent
docsSetting a default limit will allow connection reuse instead of a new connection being set for every request.
The text was updated successfully, but these errors were encountered: