]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: trim client state based on # caps, not real memory utilization
authorSage Weil <sage@newdream.net>
Fri, 29 May 2009 21:11:23 +0000 (14:11 -0700)
committerSage Weil <sage@newdream.net>
Fri, 29 May 2009 21:30:22 +0000 (14:30 -0700)
src/mds/MDCache.cc
src/mds/Server.cc
src/messages/MClientSession.h

index 22666206ea6a509c1fa2d49d4a83f632137b94bc..18eefea2b9b8a2d0fb0f7f31f5557f24d8967935 100644 (file)
@@ -5092,7 +5092,8 @@ void MDCache::check_memory_usage()
   static MemoryModel::snap baseline = last;
 
   // check client caps
-  float caps_per_inode = (float)num_caps / (float)inode_map.size();
+  int num_inodes = inode_map.size();
+  float caps_per_inode = (float)num_caps / (float)num_inodes;
   //float cap_rate = (float)num_inodes_with_caps / (float)inode_map.size();
 
   dout(0) << "check_memory_usage"
@@ -5107,11 +5108,17 @@ void MDCache::check_memory_usage()
           << ", " << num_caps << " caps, " << caps_per_inode << " caps per inode"
           << dendl;
 
-  int size = last.get_total();
+  /*int size = last.get_total();
   if (size > g_conf.mds_mem_max * .9) {
     float ratio = (float)g_conf.mds_mem_max * .9 / (float)size;
     if (ratio < 1.0)
       mds->server->recall_client_state(ratio);
+  } else 
+    */
+  if (num_inodes_with_caps > g_conf.mds_cache_size) {
+    float ratio = (float)g_conf.mds_cache_size * .9 / (float)num_inodes_with_caps;
+    if (ratio < 1.0)
+      mds->server->recall_client_state(ratio);
   }
 
 }
index 20592c28b5b0bd5ae551047452953b42b3139529..8d0b0b82a8323e54dd739ddf5ceb173fb9727176 100644 (file)
@@ -524,7 +524,7 @@ void Server::reconnect_tick()
 
 void Server::recall_client_state(float ratio)
 {
-  int max_caps_per_client = g_conf.mds_cache_size / 2;
+  int max_caps_per_client = g_conf.mds_cache_size * .8;
   int min_caps_per_client = 100;
 
   dout(10) << "recall_client_state " << ratio
index f91a46f628fefd17c4e2efb27d41630868481b3b..c823f0f0177e4a29d0ec5ab96739c744b0b7ff47 100644 (file)
@@ -46,7 +46,7 @@ public:
     if (get_seq())
       out << " seq " << get_seq();
     if (get_op() == CEPH_SESSION_RECALL_STATE)
-      out << " max_caps " << head.max_caps << " max_leases" << head.max_leases;
+      out << " max_caps " << head.max_caps << " max_leases " << head.max_leases;
     out << ")";
   }