Limits how many onodes can be evicted from OnodeCacheShard in one go.
Added bluestore_cache_meta_drop_limit that controls how fast
onodes can be evicted from cache.
Fixes: https://tracker.ceph.com/issues/73353
Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
default: 0.04
see_also:
- bluestore_cache_size
+- name: bluestore_cache_meta_evict_limit
+ type: int
+ level: advanced
+ desc: Elements in onode cache shards are evicted when new element is inserted into the cache.
+ In rare cases of cluster inactivity cache can be reduced, but not evicted. Adjusting size at once
+ will cause stall first time cache shard is accessed. The setting limits how many onodes can get evicted in one go.
+ Any value is less than 2 it is treated as request to adjust immediately.
+ default: 10
+ see_also:
+ - bluestore_cache_meta_ratio
+ with_legacy: true
- name: bluestore_cache_autotune
type: bool
level: dev
}
ldout(cache->cct, 20) << __func__ << " " << oid << " " << o << dendl;
cache->_add(o.get(), 1);
- cache->_trim();
+ cache->_trim_some();
return o;
}
o->oid = new_oid;
o->key = new_okey;
- cache->_trim();
+ cache->_trim_some();
}
bool BlueStore::OnodeSpace::map_any(std::function<bool(Onode*)> f)
}
_trim_to(max);
}
-
+ void _trim_some() {
+ int32_t max_steps = cct->_conf->bluestore_cache_meta_evict_limit;
+ int64_t new_level = max.load();
+ if (max_steps >= 2) {
+ new_level = std::max((int64_t)num.load() - max_steps, new_level);
+ }
+ _trim_to(new_level);
+ }
void trim() {
std::lock_guard l(lock);
- _trim();
+ _trim();
}
void flush() {
std::lock_guard l(lock);