opt memory usage of OccamThreadPool
This commit is contained in:
@ -105,7 +105,7 @@ inline int64_t get_monotonic_ts()
|
|||||||
extern int64_t INIT_TS;
|
extern int64_t INIT_TS;
|
||||||
extern ObOccamTimer GLOBAL_REPORT_TIMER;// used to report election event to inner table
|
extern ObOccamTimer GLOBAL_REPORT_TIMER;// used to report election event to inner table
|
||||||
|
|
||||||
inline int GLOBAL_INIT_ELECTION_MODULE(const int64_t queue_size_square_of_2 = 14)
|
inline int GLOBAL_INIT_ELECTION_MODULE(const int64_t queue_size_square_of_2 = 10)
|
||||||
{
|
{
|
||||||
int ret = common::OB_SUCCESS;
|
int ret = common::OB_SUCCESS;
|
||||||
static int64_t call_times = 0;
|
static int64_t call_times = 0;
|
||||||
|
|||||||
@ -184,7 +184,7 @@ int ObEventHistoryTableOperator::init(common::ObMySQLProxy &proxy)
|
|||||||
LOG_WARN("init twice", K(ret));
|
LOG_WARN("init twice", K(ret));
|
||||||
} else {
|
} else {
|
||||||
const int64_t thread_count = 1;
|
const int64_t thread_count = 1;
|
||||||
const int64_t queue_size_square_of_2 = 14;
|
const int64_t queue_size_square_of_2 = 10;
|
||||||
if (OB_FAIL(event_queue_.init(thread_count, "EvtHisUpdTask", TASK_QUEUE_SIZE, TASK_MAP_SIZE,
|
if (OB_FAIL(event_queue_.init(thread_count, "EvtHisUpdTask", TASK_QUEUE_SIZE, TASK_MAP_SIZE,
|
||||||
TOTAL_LIMIT, HOLD_LIMIT, PAGE_SIZE))) {
|
TOTAL_LIMIT, HOLD_LIMIT, PAGE_SIZE))) {
|
||||||
LOG_WARN("task_queue_ init failed", K(thread_count), LITERAL_K(TASK_QUEUE_SIZE),
|
LOG_WARN("task_queue_ init failed", K(thread_count), LITERAL_K(TASK_QUEUE_SIZE),
|
||||||
|
|||||||
@ -49,7 +49,7 @@ struct DefaultAllocator : public ObIAllocator {
|
|||||||
#ifdef UNIITTEST_DEBUG
|
#ifdef UNIITTEST_DEBUG
|
||||||
total_alive_num++;
|
total_alive_num++;
|
||||||
#endif
|
#endif
|
||||||
return ob_malloc(size, SET_USE_500("OccamThreadPool"));
|
return share::mtl_malloc(size, "OccamThreadPool");
|
||||||
}
|
}
|
||||||
void* alloc(const int64_t size, const ObMemAttr &attr) override {
|
void* alloc(const int64_t size, const ObMemAttr &attr) override {
|
||||||
UNUSED(attr);
|
UNUSED(attr);
|
||||||
@ -59,7 +59,7 @@ struct DefaultAllocator : public ObIAllocator {
|
|||||||
#ifdef UNIITTEST_DEBUG
|
#ifdef UNIITTEST_DEBUG
|
||||||
total_alive_num--;
|
total_alive_num--;
|
||||||
#endif
|
#endif
|
||||||
ob_free(ptr);
|
share::mtl_free(ptr);
|
||||||
}
|
}
|
||||||
#ifdef UNIITTEST_DEBUG
|
#ifdef UNIITTEST_DEBUG
|
||||||
int total_alive_num = 0;
|
int total_alive_num = 0;
|
||||||
@ -200,7 +200,7 @@ public:
|
|||||||
is_inited_(false),
|
is_inited_(false),
|
||||||
is_stopped_(false) {}
|
is_stopped_(false) {}
|
||||||
~ObOccamThreadPool() { destroy(); }
|
~ObOccamThreadPool() { destroy(); }
|
||||||
int init(int64_t thread_num, int64_t queue_size_square_of_2 = 14)
|
int init(int64_t thread_num, int64_t queue_size_square_of_2 = 10)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (is_inited_) {
|
if (is_inited_) {
|
||||||
@ -489,7 +489,7 @@ public:
|
|||||||
ObOccamThreadPool() :
|
ObOccamThreadPool() :
|
||||||
thread_num_(0),
|
thread_num_(0),
|
||||||
queue_size_square_of_2_(0) {}
|
queue_size_square_of_2_(0) {}
|
||||||
int init_and_start(int thread_num, int queue_size_square_of_2 = 14)
|
int init_and_start(int thread_num, int queue_size_square_of_2 = 10)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
ret = ob_make_shared<occam::ObOccamThreadPool>(thread_pool_);
|
ret = ob_make_shared<occam::ObOccamThreadPool>(thread_pool_);
|
||||||
|
|||||||
@ -551,7 +551,7 @@ public:
|
|||||||
int init_and_start(const int64_t worker_number,
|
int init_and_start(const int64_t worker_number,
|
||||||
const int64_t precision,
|
const int64_t precision,
|
||||||
const char *name,
|
const char *name,
|
||||||
const int64_t queue_size_square_of_2 = 14)
|
const int64_t queue_size_square_of_2 = 10)
|
||||||
{
|
{
|
||||||
TIMEGUARD_INIT(OCCAM, 100_ms);
|
TIMEGUARD_INIT(OCCAM, 100_ms);
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
|||||||
Reference in New Issue
Block a user