Skip to content
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

Support keepAlive in Node.js implementation #62

Open
vgrichina opened this issue Feb 12, 2020 · 3 comments
Open

Support keepAlive in Node.js implementation #62

vgrichina opened this issue Feb 12, 2020 · 3 comments

Comments

@vgrichina
Copy link

Most Node.js services heavy in HTTP calls to same destination benefit a lot of having keepAlive on by default, e.g. we had to do it passing agent when using node-fetch:

https://github.com/nearprotocol/nearlib/blob/master/src.ts/utils/web.ts#L24

Is there any way to enable keepAlive when using bent? Also wonder if there is any good reason to not use it by default.

@mikeal
Copy link
Owner

mikeal commented Feb 12, 2020

You shouldn’t need to pass the agent in. Node.js Core batches concurrent requests together to optimize for keep-alive. The browser does the same.

You’d only need to manage your own agent if you wanted to hold the connection between requests instead of having them closed out when there’s less load.

@frol
Copy link

frol commented Feb 13, 2020

@mikeal Our use-case involves, potentially, millions requests to the same RPC host, and we run out of the number of TCP ports without Keep-Alive.

@koalo
Copy link

koalo commented Mar 26, 2021

We also need to keep the connection alive between the requests. So we probably need to invest the effort to migrate to another library instead of bent :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants