Enlarge slog item and buffer concurrent count

This commit is contained in:
JiahuaChen
2023-07-13 02:18:02 +00:00
committed by ob-robot
parent f94aab5524
commit b0ae6c165f
3 changed files with 8 additions and 11 deletions

View File

@ -52,9 +52,6 @@ int ObStorageLoggerManager::init(
const bool need_reserved) const bool need_reserved)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
const int64_t MAX_CONCURRENT_ITEM_CNT = !lib::is_mini_mode() ?
MAX(128, sysconf(_SC_NPROCESSORS_ONLN) * 2) : 64;
static const int64_t MAX_TENANT_BUCKET = 63;
if (OB_UNLIKELY(is_inited_)) { if (OB_UNLIKELY(is_inited_)) {
ret = OB_INIT_TWICE; ret = OB_INIT_TWICE;
@ -64,9 +61,9 @@ int ObStorageLoggerManager::init(
STORAGE_REDO_LOG(WARN, "invalid arguments", K(ret), KP(log_dir), K(max_log_file_size)); STORAGE_REDO_LOG(WARN, "invalid arguments", K(ret), KP(log_dir), K(max_log_file_size));
} else if (OB_FAIL(prepare_log_buffers(MAX_CONCURRENT_ITEM_CNT, NORMAL_LOG_ITEM_SIZE))) { } else if (OB_FAIL(prepare_log_buffers(MAX_CONCURRENT_ITEM_CNT, NORMAL_LOG_ITEM_SIZE))) {
STORAGE_REDO_LOG(WARN, "fail to prepare log buffers", K(ret), STORAGE_REDO_LOG(WARN, "fail to prepare log buffers", K(ret),
K(MAX_CONCURRENT_ITEM_CNT), LITERAL_K(NORMAL_LOG_ITEM_SIZE)); LITERAL_K(MAX_CONCURRENT_ITEM_CNT), LITERAL_K(NORMAL_LOG_ITEM_SIZE));
} else if (OB_FAIL(prepare_log_items(MAX_CONCURRENT_ITEM_CNT))) { } else if (OB_FAIL(prepare_log_items(MAX_CONCURRENT_ITEM_CNT))) {
STORAGE_REDO_LOG(WARN, "fail to prepare log items", K(ret), K(MAX_CONCURRENT_ITEM_CNT)); STORAGE_REDO_LOG(WARN, "fail to prepare log items", K(ret), LITERAL_K(MAX_CONCURRENT_ITEM_CNT));
} else { } else {
log_dir_ = log_dir; log_dir_ = log_dir;
max_log_file_size_ = max_log_file_size; max_log_file_size_ = max_log_file_size;

View File

@ -70,7 +70,8 @@ private:
int get_using_disk_space(int64_t &using_space) const; int get_using_disk_space(int64_t &using_space) const;
private: private:
static constexpr int64_t NORMAL_LOG_ITEM_SIZE = 512 * 1024; //512KB static constexpr int64_t NORMAL_LOG_ITEM_SIZE = 8 * 1024; //8KB
static constexpr int64_t MAX_CONCURRENT_ITEM_CNT = 1024;
static constexpr int64_t RESERVED_DISK_SIZE = 4 * 1024 * 1024 * 1024L; // 4G static constexpr int64_t RESERVED_DISK_SIZE = 4 * 1024 * 1024 * 1024L; // 4G
common::ObArenaAllocator allocator_; common::ObArenaAllocator allocator_;

View File

@ -51,8 +51,7 @@ public:
public: public:
static const int64_t MAX_FILE_SIZE = 256 * 1024 * 1024; static const int64_t MAX_FILE_SIZE = 256 * 1024 * 1024;
const int64_t MAX_CONCURRENT_ITEM_CNT = !lib::is_mini_mode() ? const int64_t MAX_CONCURRENT_ITEM_CNT = 1024;
MAX(128, sysconf(_SC_NPROCESSORS_ONLN) * 2) : 64;
public: public:
char dir_[128]; char dir_[128];
@ -102,7 +101,7 @@ TEST_F(TestStorageLoggerManager, test_manager_basic)
log_item, 1); log_item, 1);
ASSERT_NE(OB_SUCCESS, ret); ASSERT_NE(OB_SUCCESS, ret);
// test normal item allocation (not local) // test normal item allocation (not local)
ret = SLOGGERMGR.alloc_item(30 * 1024, log_item, 15); ret = SLOGGERMGR.alloc_item(3 * 1024, log_item, 15);
ASSERT_EQ(OB_SUCCESS, ret); ASSERT_EQ(OB_SUCCESS, ret);
ASSERT_TRUE(log_item->is_inited_); ASSERT_TRUE(log_item->is_inited_);
ASSERT_FALSE(log_item->is_local_); ASSERT_FALSE(log_item->is_local_);
@ -220,7 +219,7 @@ TEST_F (TestStorageLoggerManager, test_build_item)
data_len = dummy_header.get_serialize_size() + data_len = dummy_header.get_serialize_size() +
dummy_entry.get_serialize_size() + dummy_entry.get_serialize_size() +
12; 12;
buf_size = 512<<10; buf_size = 8<<10;
ASSERT_EQ(data_len, log_item->get_data_len()); ASSERT_EQ(data_len, log_item->get_data_len());
ASSERT_EQ(data_len, log_item->get_log_data_len()); ASSERT_EQ(data_len, log_item->get_log_data_len());
ASSERT_EQ(buf_size, log_item->get_buf_size()); ASSERT_EQ(buf_size, log_item->get_buf_size());
@ -280,7 +279,7 @@ TEST_F (TestStorageLoggerManager, test_build_item)
data_len = dummy_header.get_serialize_size() + data_len = dummy_header.get_serialize_size() +
3 * dummy_entry.get_serialize_size() + 3 * dummy_entry.get_serialize_size() +
111; 111;
buf_size = 512<<10; buf_size = 8<<10;
ASSERT_EQ(data_len, log_item->get_data_len()); ASSERT_EQ(data_len, log_item->get_data_len());
ASSERT_EQ(data_len, log_item->get_log_data_len()); ASSERT_EQ(data_len, log_item->get_log_data_len());
ASSERT_EQ(buf_size, log_item->get_buf_size()); ASSERT_EQ(buf_size, log_item->get_buf_size());