Skip to content

rgw: Add request timeout to beast - #35355

Merged
cbodley merged 1 commit into
ceph:masterfrom
ofriedma:wip-ofriedma-beast-timeout
Oct 22, 2020
Merged

cbodley merged 1 commit into
ceph:masterfrom
ofriedma:wip-ofriedma-beast-timeout

Conversation

@ofriedma

@ofriedma ofriedma commented Jun 3, 2020 •

Copy link
Copy Markdown
Contributor

Add request timeout to beast

The beast frontend will use the same parameter as the civetweb one, request_timeout_ms and will be configured to 65 seconds by default

Fixes: https://tracker.ceph.com/issues/45431
Signed-off-by: Or Friedmann [email protected]

@ofriedma
ofriedma requested a review from cbodley June 3, 2020 08:15
@ofriedma ofriedma changed the title rgw: Add request timeout beast rgw: Add request timeout to beast Jun 3, 2020
@yuvalif

yuvalif commented Jun 3, 2020

Copy link
Copy Markdown
Contributor

do you have a test for this case? did you see the timer expiration error code in the log?

@yuvalif

yuvalif commented Jun 3, 2020

Copy link
Copy Markdown
Contributor

how about recycling idle tcp connection?
if client is http1.1 and uses a durable connection we may want to recycle it if it is idle.

Comment thread src/rgw/rgw_asio_frontend.cc Resolved
Comment thread src/rgw/rgw_asio_frontend.cc Resolved
@cbodley

cbodley commented Jun 5, 2020

Copy link
Copy Markdown
Contributor

how about recycling idle tcp connection?
if client is http1.1 and uses a durable connection we may want to recycle it if it is idle.

isn't it the client that decides whether to reuse a connection? clients generally implement this with a connection pool

keep-alive is the default for 1.1, and our handle_connection() reads requests in a loop until eof or !parser.keep_alive(). the effect of this new timeout is that we'll garbage collect the idle connections that are still in the client/lb's connection pool. we need this to limit our resource use at scale

interestingly, civetweb uses a separate keep_alive_timeout_ms of 500ms for these timeouts between requests, compared to the 65s timeouts for reads/writes during the request

@yuvalif

yuvalif commented Jun 7, 2020

Copy link
Copy Markdown
Contributor

how about recycling idle tcp connection?
if client is http1.1 and uses a durable connection we may want to recycle it if it is idle.

isn't it the client that decides whether to reuse a connection? clients generally implement this with a connection pool

keep-alive is the default for 1.1, and our handle_connection() reads requests in a loop until eof or !parser.keep_alive(). the effect of this new timeout is that we'll garbage collect the idle connections that are still in the client/lb's connection pool. we need this to limit our resource use at scale

interestingly, civetweb uses a separate keep_alive_timeout_ms of 500ms for these timeouts between requests, compared to the 65s timeouts for reads/writes during the request

500ms seems a bit aggressive, but it does make sense that this timeout is much shorter. what is the value of our keepalive timeout for beast?

@ofriedma
ofriedma force-pushed the wip-ofriedma-beast-timeout branch 2 times, most recently from c4d14fe to 9798d89 Compare June 7, 2020 16:46
@ofriedma

ofriedma commented Jun 7, 2020

Copy link
Copy Markdown
Contributor Author

@yuvalif Thank you for reviewing the PR
I'm testing it using tc to increase the latency.
You will need also to configure lower request_timeout_ms for example 200(ms)
For example:

tc qdisc add dev lo root netem delay 400ms
s3cmd mb s3://hello
and you will get timeout

You will see it on the logs with this error message: The socket was closed due to a timeout.
This PR means that any I/O will not take more than the configured timeout.

@ofriedma
ofriedma requested a review from cbodley June 7, 2020 16:54
Comment thread src/rgw/rgw_asio_frontend.cc Resolved
Comment thread doc/radosgw/frontends.rst Resolved
@ofriedma
ofriedma force-pushed the wip-ofriedma-beast-timeout branch 3 times, most recently from e30a3d4 to 5e94ebf Compare June 9, 2020 12:50
@ofriedma

ofriedma commented Jun 9, 2020

Copy link
Copy Markdown
Contributor Author

jenkins render docs

@ofriedma
ofriedma force-pushed the wip-ofriedma-beast-timeout branch from 5e94ebf to 82e4406 Compare June 9, 2020 14:17
Comment thread src/rgw/rgw_asio_frontend.cc Resolved
@ofriedma
ofriedma force-pushed the wip-ofriedma-beast-timeout branch from 82e4406 to 5bb1a4c Compare June 11, 2020 07:17
@ofriedma
ofriedma requested a review from cbodley June 11, 2020 07:22
@ofriedma
ofriedma force-pushed the wip-ofriedma-beast-timeout branch from 5bb1a4c to 085d040 Compare July 14, 2020 17:00

@cbodley cbodley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise looks great 👍

Comment thread src/rgw/rgw_asio_frontend.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use auto& timeout = get_lowest_layer(stream); from above to simplify this to timeout.socket().shutdown(...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for reviewing, done

@ofriedma
ofriedma force-pushed the wip-ofriedma-beast-timeout branch from 085d040 to c63d1da Compare July 19, 2020 11:02
@ivancich ivancich added the wip-eric-testing-1 for ivancich testing label Aug 18, 2020
@ivancich

Copy link
Copy Markdown
Member

@ofriedma I tried to build this for QA and I'm getting an error when building for "ubuntu | bionic | default | x86_64". It appears as though the "charconv" include file does not exist. I'll remove this from my QA run until this gets sorted out.

/build/ceph-16.0.0-4495-ge7a6729f23b/src/rgw/rgw_asio_frontend.cc:7:10: fatal error: charconv: No such file or directory
#include
^~~~~~~~~~
compilation terminated.
src/rgw/CMakeFiles/radosgw.dir/build.make:185: recipe for target 'src/rgw/CMakeFiles/radosgw.dir/rgw_asio_frontend.cc.o' failed
make[4]: *** [src/rgw/CMakeFiles/radosgw.dir/rgw_asio_frontend.cc.o] Error 1
make[4]: Leaving directory '/build/ceph-16.0.0-4495-ge7a6729f23b/obj-x86_64-linux-gnu'
make[4]: *** Waiting for unfinished jobs...

@ivancich ivancich removed the wip-eric-testing-1 for ivancich testing label Aug 18, 2020
@stale

stale Bot commented Oct 18, 2020

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@stale stale Bot added the stale label Oct 18, 2020
@theanalyst

Copy link
Copy Markdown
Member

jenkins test this please

@stale stale Bot removed the stale label Oct 18, 2020
@theanalyst

Copy link
Copy Markdown
Member

jenkins test api

@ofriedma
ofriedma force-pushed the wip-ofriedma-beast-timeout branch from c63d1da to 28a4e6a Compare October 19, 2020 12:03
Add request timeout beast

The beast frontend will use the same parameter as the civetweb one, request_timeout_ms and will be configured to 65 seconds by default

Fixes: https://tracker.ceph.com/issues/45431
Signed-off-by: Or Friedmann <[email protected]>
@ofriedma
ofriedma force-pushed the wip-ofriedma-beast-timeout branch from 28a4e6a to 5d5f9a0 Compare October 19, 2020 12:42
@ofriedma

Copy link
Copy Markdown
Contributor Author

@cbodley
cbodley merged commit 0d37cd3 into ceph:master Oct 22, 2020
@mattbenjamin

Copy link
Copy Markdown
Contributor

@ofriedma congratulations!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants