]> 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)
committerren.huanwen <ren.huanwen@zte.com.cn>
Fri, 22 Sep 2017 01:57:00 +0000 (09:57 +0800)
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>
src/common/options.cc
src/mds/Server.cc

index b5675608306f7bcd2faf429333ce01dc6a52c469..c5a5253911a02b271d1c39196b86b5c6fc76726b 100644 (file)
@@ -5781,6 +5781,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 a5ea0ca09bb73c1eee8703c8e63d8751d695400c..a079c258d465d55cce547bfdbf8acbd4faec3f4a 100644 (file)
@@ -1083,8 +1083,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