record tenant_id && adapitve update resource limit when advance clock in throttle unit

This commit is contained in:
ZenoWang
2024-02-08 17:52:44 +00:00
committed by ob-robot
parent cf54270259
commit f43ada202f
9 changed files with 62 additions and 49 deletions

View File

@ -51,7 +51,8 @@ void ObTenantMdsAllocator::init_throttle_config(int64_t &resource_limit, int64_t
max_duration = MDS_THROTTLE_MAX_DURATION;
}
}
void ObTenantMdsAllocator::adaptive_update_limit(const int64_t holding_size,
void ObTenantMdsAllocator::adaptive_update_limit(const int64_t tenant_id,
const int64_t holding_size,
const int64_t config_specify_resource_limit,
int64_t &resource_limit,
int64_t &last_update_limit_ts,

View File

@ -234,7 +234,8 @@ void ObMemstoreAllocator::init_throttle_config(int64_t &resource_limit,
}
}
void ObMemstoreAllocator::adaptive_update_limit(const int64_t holding_size,
void ObMemstoreAllocator::adaptive_update_limit(const int64_t tenant_id,
const int64_t holding_size,
const int64_t config_specify_resource_limit,
int64_t &resource_limit,
int64_t &last_update_limit_ts,

View File

@ -31,8 +31,12 @@ namespace share {
void ObSharedMemAllocMgr::update_throttle_config()
{
int64_t tenant_id = MTL_ID();
int64_t total_memory = lib::get_tenant_memory_limit(tenant_id);
if (MTL_ID() != tenant_id_) {
SHARE_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "update throttle config in an invalid tenant", K(MTL_ID()), K(tenant_id_));
return;
}
int64_t total_memory = lib::get_tenant_memory_limit(tenant_id_);
omt::ObTenantConfigGuard tenant_config(TENANT_CONF(MTL_ID()));
if (tenant_config.is_valid()) {
int64_t share_mem_limit_percentage = tenant_config->_tx_share_memory_limit_percentage;
@ -46,10 +50,10 @@ void ObSharedMemAllocMgr::update_throttle_config()
share_mem_limit_percentage = memstore_limit_percentage + 10;
}
int64_t share_mem_limit = total_memory * share_mem_limit_percentage / 100LL;
int64_t memstore_limit = total_memory * memstore_limit_percentage / 100LL;
int64_t tx_data_limit = total_memory * tx_data_limit_percentage / 100LL;
int64_t mds_limit = total_memory * mds_limit_percentage / 100LL;
int64_t share_mem_limit = total_memory / 100 * share_mem_limit_percentage;
int64_t memstore_limit = total_memory / 100 * memstore_limit_percentage;
int64_t tx_data_limit = total_memory / 100 * tx_data_limit_percentage;
int64_t mds_limit = total_memory / 100 * mds_limit_percentage;
bool share_config_changed = false;
(void)share_resource_throttle_tool_.update_throttle_config<FakeAllocatorForTxShare>(
@ -70,39 +74,22 @@ void ObSharedMemAllocMgr::update_throttle_config()
if (share_config_changed || memstore_config_changed || tx_data_config_changed || mds_config_changed) {
SHARE_LOG(INFO,
"[Throttle] Update Config",
K(tenant_id_),
K(total_memory),
K(share_mem_limit_percentage),
K(share_mem_limit),
K(memstore_limit_percentage),
K(memstore_limit),
K(tx_data_limit_percentage),
K(tx_data_limit),
K(mds_limit_percentage),
K(mds_limit),
K(trigger_percentage),
K(max_duration));
if (share_config_changed) {
SHARE_LOG(INFO,
"[Throttle] Update Config",
THROTTLE_CONFIG_LOG(FakeAllocatorForTxShare, share_mem_limit, trigger_percentage, max_duration));
}
if (memstore_config_changed) {
SHARE_LOG(INFO,
"[Throttle] Update Config",
THROTTLE_CONFIG_LOG(ObMemstoreAllocator, memstore_limit, trigger_percentage, max_duration));
}
if (tx_data_config_changed) {
SHARE_LOG(INFO,
"[Throttle] Update Config",
THROTTLE_CONFIG_LOG(ObTenantTxDataAllocator, tx_data_limit, trigger_percentage, max_duration));
}
if (mds_config_changed) {
SHARE_LOG(INFO,
"[Throttle] Update Config",
THROTTLE_CONFIG_LOG(ObTenantMdsAllocator, mds_limit, trigger_percentage, max_duration));
}
}
} else {
SHARE_LOG_RET(WARN, OB_INVALID_CONFIG, "invalid tenant config", K(tenant_id), K(total_memory));
SHARE_LOG_RET(WARN, OB_INVALID_CONFIG, "invalid tenant config", K(tenant_id_), K(total_memory));
}
}

View File

@ -23,8 +23,7 @@ namespace share {
class ObSharedMemAllocMgr {
public:
ObSharedMemAllocMgr()
: share_resource_throttle_tool_(),
ObSharedMemAllocMgr(): share_resource_throttle_tool_(),
memstore_allocator_(),
tx_data_allocator_(),
mds_allocator_() {}
@ -47,8 +46,9 @@ public:
share_resource_throttle_tool_.init(&memstore_allocator_, &tx_data_allocator_, &mds_allocator_))) {
SHARE_LOG(ERROR, "init share resource throttle tool failed", KR(ret));
} else {
tenant_id_ = MTL_ID();
share_resource_throttle_tool_.enable_adaptive_limit<FakeAllocatorForTxShare>();
SHARE_LOG(INFO, "finish init mtl share mem allocator mgr", K(MTL_ID()), KP(this));
SHARE_LOG(INFO, "finish init mtl share mem allocator mgr", K(tenant_id_), KP(this));
}
return ret;
}
@ -71,6 +71,7 @@ private:
void update_mds_throttle_config_(const int64_t total_memory, omt::ObTenantConfigGuard &config);
private:
int64_t tenant_id_;
TxShareThrottleTool share_resource_throttle_tool_;
ObMemstoreAllocator memstore_allocator_;
ObTenantTxDataAllocator tx_data_allocator_;

View File

@ -48,7 +48,8 @@ void ObTenantTxDataAllocator::init_throttle_config(int64_t &resource_limit,
max_duration = TX_DATA_THROTTLE_MAX_DURATION;
}
}
void ObTenantTxDataAllocator::adaptive_update_limit(const int64_t holding_size,
void ObTenantTxDataAllocator::adaptive_update_limit(const int64_t tenant_id,
const int64_t holding_size,
const int64_t config_specify_resource_limit,
int64_t &resource_limit,
int64_t &last_update_limit_ts,