]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: adding tunable features for caps_per_client
authorren.huanwen <ren.huanwen@zte.com.cn>
Mon, 18 Sep 2017 07:14:19 +0000 (15:14 +0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Fri, 29 Sep 2017 00:12:42 +0000 (17:12 -0700)
Sometimes we need to raise or lower the value of "max_caps_per_client" and
"min_caps_per_client" to improve recall_client_state efficiency

Signed-off-by: ren.huanwen <ren.huanwen@zte.com.cn>
(cherry picked from commit a07b376628505832f5528bd7f2b0faeabe9a5f5d)

src/common/options.cc
src/mds/Server.cc

index 0be052e1bc551eaf3787bbc205afda66f52b3598..8578d464cb9bfc9b7ed147516eb63e876b3ffb91 100644 (file)
@@ -5748,6 +5748,14 @@ std::vector<Option> get_mds_options() {
     Option("mds_client_writeable_range_max_inc_objs", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(1024)
     .set_description(""),
+    
+    Option("mds_min_caps_per_client", Option::TYPE_INT, Option::LEVEL_ADVANCED)
+    .set_default(100)
+    .set_description("Set the minimum cache number of client"),
+
+    Option("mds_max_ratio_caps_per_client", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
+    .set_default(.8)
+    .set_description("Set the maximum cache number ratio of client"),
   });
 }
 
index 3d34bd4c1caa0f45835b4af664da5215d5a5b4fc..40053998434488d5cef29a0573d1bee47a8fa431 100644 (file)
@@ -1085,8 +1085,14 @@ void Server::recover_filelocks(CInode *in, bufferlist locks, int64_t client)
 void Server::recall_client_state(void)
 {
   /* try to recall at least 80% of all caps */
-  uint64_t max_caps_per_client = (Capability::count() * .8);
-  uint64_t min_caps_per_client = 100;
+  uint64_t max_caps_per_client = (uint64_t)(Capability::count() * g_conf->get_val<float>("mds_max_ratio_caps_per_client"));
+  uint64_t min_caps_per_client = (uint64_t)g_conf->get_val<int>("mds_min_caps_per_client");
+  if (max_caps_per_client < min_caps_per_client) {
+    dout(0) << "max_caps_per_client " << max_caps_per_client
+            << "<" << "min_caps_per_client " << min_caps_per_client << dendl;
+    max_caps_per_client = min_caps_per_client + 1;
+  }
+   
   /* unless this ratio is smaller: */
   /* ratio: determine the amount of caps to recall from each client. Use
    * percentage full over the cache reservation. Cap the ratio at 80% of client