From d4c83d576552968da1e27f5d47929ee0e5d07a39 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 10 May 2021 11:17:50 -0400 Subject: [PATCH] rgw: add config option to disable beast's async process_request() when disabled, a null_yield is given to process_request() so that it runs synchronously. mostly intended for debugging Signed-off-by: Casey Bodley --- src/common/options/rgw.yaml.in | 13 +++++++++++++ src/rgw/rgw_asio_frontend.cc | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/common/options/rgw.yaml.in b/src/common/options/rgw.yaml.in index 6f7f769d5790b..74ed33eca66a1 100644 --- a/src/common/options/rgw.yaml.in +++ b/src/common/options/rgw.yaml.in @@ -1840,6 +1840,19 @@ options: default: beast ssl_certificate=config://rgw/cert/$realm/$zone.crt ssl_private_key=config://rgw/cert/$realm/$zone.key services: - rgw +- name: rgw_beast_enable_async + type: bool + level: dev + desc: Enable async request processing under beast using coroutines + long_desc: When enabled, the beast frontend will process requests using + coroutines, allowing the concurrent processing of several requests on the + same thread. When disabled, the number of concurrent requests will be + limited by the thread count, but debugging and tracing the synchronous + calls can be easier. + default: true + services: + - rgw + with_legacy: true - name: rgw_user_quota_bucket_sync_interval type: int level: advanced diff --git a/src/rgw/rgw_asio_frontend.cc b/src/rgw/rgw_asio_frontend.cc index 75c63034a1d47..e9f46265a7026 100644 --- a/src/rgw/rgw_asio_frontend.cc +++ b/src/rgw/rgw_asio_frontend.cc @@ -250,7 +250,10 @@ void handle_connection(boost::asio::io_context& context, rgw::io::add_conlen_controlling( &real_client)))); RGWRestfulIO client(cct, &real_client_io); - auto y = optional_yield{context, yield}; + optional_yield y = null_yield; + if (cct->_conf->rgw_beast_enable_async) { + y = optional_yield{context, yield}; + } int http_ret = 0; string user = "-"; const auto started = ceph::coarse_real_clock::now(); -- 2.39.5