opt ObSQLSessionInfo
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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<int32_t>(nway));
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user