diff --git a/deps/oblib/src/lib/allocator/ob_slice_alloc.h b/deps/oblib/src/lib/allocator/ob_slice_alloc.h index 613e88dafc..a8f1cf0b71 100644 --- a/deps/oblib/src/lib/allocator/ob_slice_alloc.h +++ b/deps/oblib/src/lib/allocator/ob_slice_alloc.h @@ -236,6 +236,12 @@ public: h ^= h >> 33; return h; } + static int32_t get_blk_size(int32_t slice_size, int32_t slice_cnt) + { + int32_t isize = (int32_t)lib::align_up2(sizeof(Item) + slice_size, 16); + int32_t blk_size = (isize + sizeof(void*)) * slice_cnt + sizeof(ObBlockSlicer); + return blk_size; + } Item* alloc_item() { Item* ret = NULL; ret = alloc_stock()? (Item*)flist_.pop(): NULL; diff --git a/deps/oblib/src/lib/objectpool/ob_concurrency_objpool.h b/deps/oblib/src/lib/objectpool/ob_concurrency_objpool.h index b13ad36131..65227255d1 100644 --- a/deps/oblib/src/lib/objectpool/ob_concurrency_objpool.h +++ b/deps/oblib/src/lib/objectpool/ob_concurrency_objpool.h @@ -45,9 +45,10 @@ class ObFixedClassAllocator public: using object_type = T; public: - ObFixedClassAllocator(const ObMemAttr &attr, int64_t nway) + ObFixedClassAllocator(const ObMemAttr &attr, int64_t nway, int32_t slice_cnt = 0) : allocator_(sizeof(T) + sizeof(ObClassMeta), attr, - choose_blk_size(sizeof(T) + sizeof(ObClassMeta))) + 0 == slice_cnt ? choose_blk_size(sizeof(T) + sizeof(ObClassMeta)) : + ObBlockSlicer::get_blk_size(sizeof(T) + sizeof(ObClassMeta), slice_cnt)) { allocator_.set_nway(static_cast(nway)); } diff --git a/src/sql/session/ob_sql_session_mgr.cpp b/src/sql/session/ob_sql_session_mgr.cpp index 1d3d0ec380..6e2c614caa 100644 --- a/src/sql/session/ob_sql_session_mgr.cpp +++ b/src/sql/session/ob_sql_session_mgr.cpp @@ -97,7 +97,7 @@ int64_t ObTenantSQLSessionMgr::SessionPool::count() const ObTenantSQLSessionMgr::ObTenantSQLSessionMgr(const int64_t tenant_id) : tenant_id_(tenant_id), - session_allocator_(lib::ObMemAttr(tenant_id, "SQLSessionInfo"), MTL_CPU_COUNT()) + session_allocator_(lib::ObMemAttr(tenant_id, "SQLSessionInfo"), MTL_CPU_COUNT(), 4) {} ObTenantSQLSessionMgr::~ObTenantSQLSessionMgr() @@ -106,7 +106,7 @@ ObTenantSQLSessionMgr::~ObTenantSQLSessionMgr() int ObTenantSQLSessionMgr::init() { int ret = OB_SUCCESS; - if (OB_FAIL(session_pool_.init(MTL_IS_MINI_MODE() ? 32 : SessionPool::POOL_CAPACIPY))) { + if (OB_FAIL(session_pool_.init(SessionPool::POOL_CAPACIPY))) { LOG_WARN("fail to init session pool", K(tenant_id_), K(ret)); } return ret; diff --git a/src/sql/session/ob_sql_session_mgr.h b/src/sql/session/ob_sql_session_mgr.h index fee5c47ea3..dc91ff406c 100644 --- a/src/sql/session/ob_sql_session_mgr.h +++ b/src/sql/session/ob_sql_session_mgr.h @@ -308,7 +308,7 @@ private: class SessionPool { public: - static const int64_t POOL_CAPACIPY = 512; + static const int64_t POOL_CAPACIPY = 32; public: SessionPool(); int init(const int64_t capacity);