[CP] [FEAT MERGE] chunk_mgr_opt

This commit is contained in:
tushicheng
2024-03-14 09:46:12 +00:00
committed by ob-robot
parent d6e0624219
commit 668b1289ad
8 changed files with 278 additions and 378 deletions

View File

@ -183,21 +183,15 @@ int ObServerReloadConfig::operator()()
reserve);
}
int64_t cache_size = GCONF.memory_chunk_cache_size;
if (0 == cache_size) {
bool use_large_chunk_cache = 1 != cache_size;
if (0 == cache_size || 1 == cache_size) {
cache_size = GMEMCONF.get_server_memory_limit();
if (cache_size >= (32L<<30)) {
cache_size -= (4L<<30);
}
}
int64_t large_cache_size = GCONF._memory_large_chunk_cache_size;
if (0 == large_cache_size) {
large_cache_size = lib::AChunkMgr::DEFAULT_LARGE_CHUNK_CACHE_SIZE;
}
lib::AChunkMgr::instance().set_max_chunk_cache_size(cache_size);
lib::AChunkMgr::instance().set_max_large_chunk_cache_size(large_cache_size);
lib::AChunkMgr::instance().set_max_chunk_cache_size(cache_size, use_large_chunk_cache);
if (!is_arbitration_mode) {
// Refresh cluster_id, cluster_name_hash for non arbitration mode

View File

@ -220,8 +220,6 @@ DEF_CAP(cache_wash_threshold, OB_CLUSTER_PARAMETER, "4GB", "[0B,]",
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_CAP(memory_chunk_cache_size, OB_CLUSTER_PARAMETER, "0M", "[0M,]", "the maximum size of memory cached by memory chunk cache. Range: [0M,], 0 stands for adaptive",
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_CAP(_memory_large_chunk_cache_size, OB_CLUSTER_PARAMETER, "0M", "[0M,]", "the maximum size of large memory cached by memory chunk cache. Range: [0M,], 0 stands for adaptive",
ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_TIME(autoinc_cache_refresh_interval, OB_CLUSTER_PARAMETER, "3600s", "[100ms,]",
"auto-increment service cache refresh sync_value in this interval, "
"with default 3600s. Range: [100ms, +∞)",

View File

@ -123,43 +123,15 @@ int ObTenantMemoryPrinter::print_tenant_usage()
}
// print global chunk freelist
const int64_t max_unmanaged_memory_size = 10LL<<30;
int64_t resident_size = 0;
int64_t memory_used = get_virtual_memory_used(&resident_size);
_STORAGE_LOG(INFO,
"[CHUNK_MGR] free=%ld pushes=%ld pops=%ld limit=%'15ld hold=%'15ld total_hold=%'15ld used=%'15ld" \
" freelist_hold=%'15ld large_freelist_hold=%'15ld" \
" maps=%'15ld unmaps=%'15ld" \
" large_maps=%'15ld large_unmaps=%'15ld" \
" huge_maps=%'15ld huge_unmaps=%'15ld" \
" memalign=%d resident_size=%'15ld"
#ifndef ENABLE_SANITY
" virtual_memory_used=%'15ld\n",
#else
" virtual_memory_used=%'15ld actual_virtual_memory_used=%'15ld\n",
#endif
CHUNK_MGR.get_free_chunk_count(),
CHUNK_MGR.get_free_chunk_pushes(),
CHUNK_MGR.get_free_chunk_pops(),
CHUNK_MGR.get_limit(),
CHUNK_MGR.get_hold(),
CHUNK_MGR.get_total_hold(),
CHUNK_MGR.get_used(),
CHUNK_MGR.get_freelist_hold() + CHUNK_MGR.get_large_freelist_hold(),
CHUNK_MGR.get_large_freelist_hold(),
CHUNK_MGR.get_maps(),
CHUNK_MGR.get_unmaps(),
CHUNK_MGR.get_large_maps(),
CHUNK_MGR.get_large_unmaps(),
CHUNK_MGR.get_huge_maps(),
CHUNK_MGR.get_huge_unmaps(),
0,
resident_size,
#ifndef ENABLE_SANITY
memory_used
#else
memory_used - CHUNK_MGR.get_shadow_hold(), memory_used
#endif
);
int64_t limit = CHUNK_MGR.get_limit();
if (resident_size > limit + max_unmanaged_memory_size) {
LOG_ERROR("RESIDENT_SIZE OVER MEMORY_LIMIT", K(resident_size), K(limit));
}
int64_t pos = CHUNK_MGR.to_string(print_buf, BUF_LEN);
_STORAGE_LOG(INFO, "%.*s", static_cast<int>(pos), print_buf);
ObMallocTimeMonitor::get_instance().print();
print_mutex_.unlock();
}