Skip to content

Commit 9dc0248

Browse files
author
wuxianrong
committed
braft Performance optimization
1 parent 720c150 commit 9dc0248

File tree

5 files changed

+230
-83
lines changed

5 files changed

+230
-83
lines changed

src/praft/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ add_dependencies(binlog_pb protobuf)
2121
# Collect all source files (excluding binlog.proto which is in binlog_pb)
2222
aux_source_directory(./src DIR_SRCS)
2323

24+
# Add batch_manager source files explicitly
25+
set(DIR_SRCS ${DIR_SRCS}
26+
${CMAKE_CURRENT_SOURCE_DIR}/batch_manager.cc
27+
)
28+
2429
# Create static library (WITHOUT binlog protobuf sources, link binlog_pb instead)
2530
add_library(praft STATIC ${DIR_SRCS})
2631

src/praft/include/praft/praft.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "pstd/include/pstd_mutex.h"
2222
#include "pstd/include/pstd_status.h"
2323
#include "rocksdb/status.h"
24+
#include "batch_manager.h"
2425

2526
class PikaServer;
2627

@@ -237,6 +238,9 @@ class RaftManager {
237238
mutable std::shared_mutex nodes_mutex_;
238239
std::unordered_map<std::string, std::shared_ptr<PikaRaftNode>> raft_nodes_;
239240

241+
// Batch managers for each database (for request batching optimization)
242+
std::unordered_map<std::string, std::unique_ptr<BatchManager>> batch_managers_;
243+
240244
// Storage reference for applying binlog
241245
storage::Storage* storage_ = nullptr;
242246

0 commit comments

Comments
 (0)