reduce pkt-nio pre-allocated memory

This commit is contained in:
liucc1997
2023-06-06 04:18:05 +00:00
committed by ob-robot
parent 6307df5985
commit ea8a31197f
3 changed files with 13 additions and 2 deletions

View File

@ -53,7 +53,7 @@ int ObPocServerHandleContext::create(int64_t resp_id, const char* buf, int64_t s
ObCurTraceId::set(tmp_pkt.get_trace_id());
obrpc::ObRpcPacketCode pcode = tmp_pkt.get_pcode();
auto &set = obrpc::ObRpcPacketSet::instance();
const char* pcode_label = set.name_of_idx(set.idx_of_pcode(pcode));
const char* pcode_label = set.label_of_idx(set.idx_of_pcode(pcode));
const int64_t pool_size = sizeof(ObPocServerHandleContext) + sizeof(ObRequest) + sizeof(ObRpcPacket) + alloc_payload_sz;
int64_t tenant_id = tmp_pkt.get_tenant_id();
if (OB_UNLIKELY(tmp_pkt.get_group_id() == OBCG_ELECTION)) {

View File

@ -74,6 +74,7 @@ class ObRpcPacketSet
{
#define PCODE_DEF(name, id) \
names_[name] = #name; \
labels_[name] = "[L]"#name; \
pcode_[name] = obrpc::name; \
index_[obrpc::name] = name;
#include "rpc/obrpc/ob_rpc_packet_list.h"
@ -99,6 +100,15 @@ public:
return name;
}
const char *label_of_idx(int64_t idx) const
{
const char *name = "Unknown";
if (idx >= 0 && idx < PCODE_COUNT) {
name = labels_[idx];
}
return name;
}
ObRpcPacketCode pcode_of_idx(int64_t idx) const
{
ObRpcPacketCode pcode = OB_INVALID_RPC_CODE;
@ -120,6 +130,7 @@ private:
static ObRpcPacketSet instance_;
const char *names_[PCODE_COUNT];
const char *labels_[PCODE_COUNT];
ObRpcPacketCode pcode_[PCODE_COUNT];
int64_t index_[OB_PACKET_NUM];
};

View File

@ -1,4 +1,4 @@
static int64_t MIN_IBUFFER_SIZE = (1<<21) - (1<<15);
static int64_t MIN_IBUFFER_SIZE = (1<<17) - 128;
static void* ib_alloc(int64_t sz, int mod) {
return ref_alloc(sz, mod);