-
Notifications
You must be signed in to change notification settings - Fork 43
Makes health checks flexible so they don't tear down connections under heavy load #328
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
Makes health checks flexible so they don't tear down connections under heavy load #328
Conversation
|
@mzimbres this is a very early prototype, and probably far from the implementation you were expecting. I want to have some discussion to make sure the direction I've taken doesn't have any flaws. The idea is that the health checker task disappears, with health checks performed by the writer and reader directly. On the writer side:
On the reader side:
Let me know what you think. |
7ee4d55 to
c2fa491
Compare
c2fa491 to
5ddcdd5
Compare
|
I've kept the
My line of thought is that this is really imposing a timeout to reads, but implemented using polling. I think it can be more unreliable than just using I've chosen this I'm open to changing the implementation if there is something I've missed here, let me know. I've also updated the reader and writer actions to be variant-like, so they take less stack space. I've used unions with a lean class interface to make it lighter at compile time. |
|
|
||
| /// Message used by the health-checker in @ref boost::redis::basic_connection::async_run. | ||
| /// Message used by `PING` commands sent by the health checker. | ||
| std::string health_check_id = "Boost.Redis"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sidenote: When the user does not provide one id, I think we should format this to contain the id returned by the HELLO command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean "does not provide one id" here? Leave health_check_id to the default? Make health_check_id empty?
The change is not trivial because it requires coordination between the setup task (which may not contain a HELLO at all) and the health checker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, if the user does not provide its own health_check_id the connection could set it to "Boost.Redis (conn-id)". At the moment we only set to "Boost.Redis".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd need to detect whether the setup request contains a hello, and then parse the response and update the ping ID. Do you think it's worth it?
|
I am still studying the code but I think the writter-offset should be moved down to the multiplexer where the writer buffer is located. The writer-fsm can then call auto buf = asio::buffer(conn->st_.mpx.get_write_buffer().substr(act.write_offset()));because the multiplexer knowns about the offset, so |
I think this is a very good idea. I will work on it. |
|
Comments applied. |
Adds
error::write_timeoutclose #104