lower the cpu cost in open-source mini-mode

This commit is contained in:
hnwyllmm
2022-02-17 10:27:48 +08:00
committed by LINxiansheng
parent e03047055d
commit 5f699b5711
2 changed files with 9 additions and 2 deletions

View File

@ -15,6 +15,7 @@
#include "rpc/obrpc/ob_rpc_proxy.h"
#include "rpc/obrpc/ob_rpc_proxy_macros.h"
#include "lib/utility/ob_unify_serialize.h"
#include "lib/ob_running_mode.h"
#include "common/ob_partition_key.h"
#include "election/ob_election_group_id.h"
#include "share/config/ob_server_config.h"
@ -38,7 +39,11 @@ enum {
inline int64_t get_batch_delay_us(const int batch_type)
{
int64_t delay[BATCH_REQ_TYPE_COUNT] = {2 * 1000, 2 * 1000, 1 * 1000, 0, 20, 0, 0, 0, 5 * 1000};
return (batch_type >= 0 && batch_type < BATCH_REQ_TYPE_COUNT) ? delay[batch_type] : 0;
int64_t delay_us = (batch_type >= 0 && batch_type < BATCH_REQ_TYPE_COUNT) ? delay[batch_type] : 0;
if (lib::is_mini_mode()) {
delay_us *= 100;
}
return delay_us;
}
inline int64_t get_batch_buffer_size(const int batch_type)

View File

@ -88,6 +88,8 @@ void ObLockWaitMgr::destroy()
void ObLockWaitMgr::run1()
{
const int interval_us = (lib::is_mini_mode() ? 10 : 1000) * 1000;
(void)prctl(PR_SET_NAME, "ObLockWaitMgr", 0, 0, 0);
while (!has_set_stop() || !is_hash_empty()) {
ObLink* iter = check_timeout();
@ -97,7 +99,7 @@ void ObLockWaitMgr::run1()
(void)repost(cur);
}
usleep(10000);
usleep(interval_us);
}
}