]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tools: update immutable object cache water mark 38725/head
authorYin Congmin <congmin.yin@intel.com>
Fri, 25 Dec 2020 16:01:34 +0000 (00:01 +0800)
committerYin Congmin <congmin.yin@intel.com>
Wed, 6 Jan 2021 01:18:48 +0000 (09:18 +0800)
Signed-off-by: Yin Congmin <congmin.yin@intel.com>
PendingReleaseNotes
doc/rbd/rbd-persistent-read-only-cache.rst
src/common/options.cc
src/test/immutable_object_cache/test_SimplePolicy.cc
src/tools/immutable_object_cache/ObjectCacheStore.cc
src/tools/immutable_object_cache/SimplePolicy.cc

index 4d4513e99b383aa3c299ad14d417e9b5851e654e..c4f07b575a6534a1533dbbb9354766f56f52de0f 100644 (file)
 * An AWS-compliant API: "GetTopicAttributes" was added to replace the existing "GetTopic" API. The new API
   should be used to fetch information about topics used for bucket notifications.
 
+* librbd: The shared, read-only parent cache's config option ``immutable_object_cache_watermark`` now has been updated
+  to property reflect the upper cache utilization before space is reclaimed. The default ``immutable_object_cache_watermark``
+  now is ``0.9``. If the capacity reaches 90% the daemon will delete cold cache.
+
 >=15.0.0
 --------
 
index dbaa66035e3d67004f1cb58ad09679bd98fa053f..3b17efb9cec921bd8d6df7ce5d2321f93662ae29 100644 (file)
@@ -116,8 +116,8 @@ The ``ceph-immutable-object-cache`` daemon is available within the optional
 .. important:: ``ceph-immutable-object-cache`` daemon requires the ability to
    connect RADOS clusters.
 
-Run Daemon
-----------
+Running the Immutable Object Cache Daemon
+-----------------------------------------
 
 ``ceph-immutable-object-cache`` daemon should use a unique Ceph user ID.
 To `create a Ceph user`_, with ``ceph`` specify the ``auth get-or-create``
@@ -137,7 +137,7 @@ The ``ceph-immutable-object-cache`` can also be run in foreground by ``ceph-immu
 QOS Settings
 ------------
 
-Immutable object cache supports throttle, controlled by the following settings.
+The immutable object cache supports throttling, controlled by the following settings:
 
 ``immutable_object_cache_qos_schedule_tick_min``
 
index 2dd0e07b8a61f1a3d12271fc61bd3079429a5c27..e3ef3bcb3e0c5d4caee54972536b63582458e5bb 100644 (file)
@@ -7910,7 +7910,7 @@ static std::vector<Option> get_immutable_object_cache_options() {
     .set_description("immutable object cache client dedicated thread number"),
 
     Option("immutable_object_cache_watermark", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
-    .set_default(0.1)
+    .set_default(0.9)
     .set_description("immutable object cache water mark"),
 
     Option("immutable_object_cache_qos_schedule_tick_min", Option::TYPE_MILLISECS, Option::LEVEL_ADVANCED)
index dee6b5b417bb04898d032fbd60d1a9c871898620..26f503be4f7fc204571d0d4b4be79a92e419c52d 100644 (file)
@@ -30,7 +30,7 @@ public:
   static void SetUpTestCase() {}
   static void TearDownTestCase() {}
   void SetUp() override {
-    m_simple_policy = new SimplePolicy(g_ceph_context, m_cache_size, 128, 0.1);
+    m_simple_policy = new SimplePolicy(g_ceph_context, m_cache_size, 128, 0.9);
     // populate 50 entries
     for (uint64_t i = 0; i < m_cache_size / 2; i++, m_entry_index++) {
       insert_entry_into_promoted_lru(generate_file_name(m_entry_index));
@@ -210,7 +210,7 @@ TEST_F(TestSimplePolicy, test_update_state_from_promoting_to_promoted) {
 
 TEST_F(TestSimplePolicy, test_evict_list_0) {
   std::list<std::string> evict_entry_list;
-  // 0.1 is watermark
+  // the default water mark is 0.9
   ASSERT_TRUE((float)m_simple_policy->get_free_size() > m_cache_size*0.1);
   m_simple_policy->get_evict_list(&evict_entry_list);
   ASSERT_TRUE(evict_entry_list.size() == 0);
index 18f64250ff77d1083def2dab20779548b31d1867..483687ffe5fc9af95fb2fb38d36d7a4abbccc924 100644 (file)
@@ -88,6 +88,10 @@ ObjectCacheStore::ObjectCacheStore(CephContext *cct)
                    ("immutable_object_cache_qos_bps_burst_seconds"));
   }
 
+  if ((cache_watermark <= 0) || (cache_watermark > 1)) {
+    lderr(m_cct) << "Invalid water mark provided, set it to default." << dendl;
+    cache_watermark = 0.9;
+  }
   m_policy = new SimplePolicy(m_cct, cache_max_size, max_inflight_ops,
                               cache_watermark);
 }
@@ -161,7 +165,8 @@ int ObjectCacheStore::do_promote(std::string pool_nspace, uint64_t pool_id,
                    << " snapshot: " << snap_id << dendl;
 
   int ret = 0;
-  std::string cache_file_name = get_cache_file_name(pool_nspace, pool_id, snap_id, object_name);
+  std::string cache_file_name =
+    get_cache_file_name(pool_nspace, pool_id, snap_id, object_name);
   librados::IoCtx ioctx;
   {
     std::lock_guard _locker{m_ioctx_map_lock};
@@ -247,7 +252,8 @@ int ObjectCacheStore::lookup_object(std::string pool_nspace, uint64_t pool_id,
                    << " in pool ID : " << pool_id << dendl;
 
   int pret = -1;
-  std::string cache_file_name = get_cache_file_name(pool_nspace, pool_id, snap_id, object_name);
+  std::string cache_file_name =
+    get_cache_file_name(pool_nspace, pool_id, snap_id, object_name);
 
   cache_status_t ret = m_policy->lookup_object(cache_file_name);
 
index 7dbd9d34bd9cfbb8a212debdb63505301e60fc3b..3a7375ba97626acf78b6d66f33cbc188934d72d7 100644 (file)
@@ -170,7 +170,7 @@ void SimplePolicy::get_evict_list(std::list<std::string>* obj_list) {
 
   std::unique_lock locker{m_cache_map_lock};
   // check free ratio, pop entries from LRU
-  if ((double)m_cache_size / m_max_cache_size > (1 - m_watermark)) {
+  if ((double)m_cache_size > m_max_cache_size * m_watermark) {
     // TODO(dehao): make this configurable
     int evict_num = m_cache_map.size() * 0.1;
     for (int i = 0; i < evict_num; i++) {