-
-
Notifications
You must be signed in to change notification settings - Fork 619
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
Keep alive #1081
Keep alive #1081
Conversation
I wonder if it worth making keepAlive on by default. If it won't add perf degradation and regression overall it'll potentially make life easier for many |
Also if it's default off and not mentioned in read me there is 0 chance it'll be used anywhere in prod |
It's up to you. I can update the PR if you want, but I wanted to err on the side of caution. |
There are some other issues that talk about ECONNRESET. In the first one the reporter is using Docker Swarm, so I'm pretty sure it's the same issue I was running up against. At any rate, I wonder if there are some other members of the community that could test this change by enabling keep-alive manually using the new options in this PR. Then the option could be enabled by default if it's viewed as generally beneficial. |
Yeah, let's soft launch it first and I'll just advise all similar reports to try keepAlive option, later we can document and enable on by default |
@sidorares can you up the npm version so the |
after some thought - maybe Line 39 in f9b9f96
|
I mentioned this as an aside over in #683, but I'm not up to speed on the four branches in the code referenced above (lines 31-45). There are 4 ways that
Is my understanding of (3) and (4) accurate? And in those cases, since the user is creating the stream, is it essentially up to them to enable keep-alive if they want to use it? |
@benbotto yes, all correct |
option 4 was added later when I realised that pool needs a way to know how to create new underlying connection and it was too late to remove option 3 |
Cool, thanks for the clarification. I made the changed and added a new PR: #1086 |
FYI: documentation should have been updated in this PR. |
The following [PR](sidorares/node-mysql2#1081) added two new options to mysql's Pool creation. I am simply adding them to the library in this PR.
The following [PR](sidorares/node-mysql2#1081) added two new options to mysql's Pool creation. I am simply adding them to the library in this PR.
This deserves to be on the front page of the documentation. Took a lot of traveling down various rabbit holes to come upon this relatively simple solution. Would be great if this showed up on https://www.npmjs.com/package/mysql2 as well. |
run this command in mysql client command terminal, the timeout unit is seconds |
This PR allows the user to enable keep-alive on the underlying socket with a configurable
initialDelay
parameter, in milliseconds. Keep-alive is disabled by default. Example usage: