-
Notifications
You must be signed in to change notification settings - Fork 377
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
Reuse TCP connections for JSON-RPC calls within an ethereum node #253
Comments
Btw, the error after exhausting available ports is this one:
|
So, we have these three dependencies:
The problem is that request (as of 2.12.4) creates a fresh Session for each high-level call. We need to patch tinyrpc to create a Session object instead of relying in the high-level request's api, by reusing a session we will benefit of connection reuse provided by urllib3 (if supported by the ethereum node) |
Note: The configuration is only a work around for orchestration, it must not be used with a standard raiden/ethereum node. Reference: https://vincent.bernat.im/en/blog/2014-tcp-time-wait-state-linux.html |
Yes I also agree regarding the sysctl configuration. Regarding tinyrpc that's quite strange that it does not support sessions at all. At least I can't see anything in its documentaiton. In that case maybe a less hackish idea would be to resort to a different library for RPC, one that would support connection reuse via sessions? |
I believe this should be raised against the tinyrpc upstream. I guess a PR there wouldn't hurt. |
see my PR mbr/tinyrpc#31 -- until this get's merged (and backported!), we can probably get away with monkey-patching |
This modifies the `tinyrpc` transport of the jsonrpc client to reuse addresses. See the linked issue for details.
This modifies the `tinyrpc` transport of the jsonrpc client to reuse addresses. See the linked issue for details.
When running multiple raiden nodes on a single Linux machine, somewhere between 20 and 30 nodes, will cause exhaustion of available TCP ports. The default for Linux is to use ports between
32768 - 61000
which gives a total of around 28K ports. Every time a new RPC connection is made new TCP port is opened for that connection and stays inTIME_WAIT
state. The default recycle time for Linux is big enough that available ports are exhausted.For doing orchestrated runs I added two extra sysctl configuration options:
That is good enough for running in orchestration but a better solution should be devised. The best option would probably be to reuse the same connections that were already opened before.
The text was updated successfully, but these errors were encountered: