From 9e16aca13d62b7eea66d1ae608d956a3961e3f8a Mon Sep 17 00:00:00 2001 From: Kajetan Janiak Date: Wed, 18 Nov 2020 11:42:07 +0100 Subject: [PATCH] rgw: disable prefetch in rgw_file Each call to rgw_read (rgw_file.cc) invokes three calls to RGWRados::get_obj_state with s->prefetch_data=true. It results in great read amplification. If length argument in rgw_read call is smaller than rgw_max_chunk_size, then the amplification is threefold. Signed-off-by: Kajetan Janiak (cherry picked from commit f915e21e5a1baf6030c1407b3058d4f58c638df9) Conflicts: src/rgw/rgw_op.cc Cherry-pick notes: - Octopus sets prfetch data flag through Rados method vs. method on object --- src/rgw/rgw_file.h | 2 ++ src/rgw/rgw_op.cc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 32449721ea1f6..ac8ada0251f5f 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -2164,6 +2164,8 @@ public: return 0; } + bool prefetch_data() override { return false; } + }; /* RGWReadRequest */ /* diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index ec0dbf64361dc..7dc50a6ce1c79 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -966,7 +966,7 @@ int RGWGetObj::verify_permission() { obj = rgw_obj(s->bucket, s->object); store->getRados()->set_atomic(s->obj_ctx, obj); - if (get_data) { + if (prefetch_data()) { store->getRados()->set_prefetch_data(s->obj_ctx, obj); } -- 2.39.5