Skip to content

Commit

Permalink
[#11720] DocDB: Use lightweight protobuf for sending Perform request.
Browse files Browse the repository at this point in the history
Summary:
We use google protobuf for cummunicating between nodes or postgres and tserver.
Native protobuf implementation allocates a lot of memory while generating requests.
This diff switches Perform RPC to our lightweight protobuf implementation.
What uses arena for allocation and tries to avoid allocation as much as possible.

Test Plan: Jenkins

Reviewers: lnguyen

Reviewed By: lnguyen

Subscribers: smishra, ybase, bogdan

Differential Revision: https://phabricator.dev.yugabyte.com/D16088
  • Loading branch information
spolitov committed Mar 25, 2022
1 parent cf5fead commit facc362
Show file tree
Hide file tree
Showing 66 changed files with 898 additions and 797 deletions.
20 changes: 14 additions & 6 deletions cmake_modules/FindYRPC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#########
find_package(Protobuf REQUIRED)

macro(YRPC_PROCESS_FILE FIL)
macro(YRPC_PROCESS_FILE FIL MESSAGES)
get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
get_filename_component(FIL_WE ${FIL} NAME_WE)

Expand Down Expand Up @@ -69,7 +69,7 @@ macro(YRPC_PROCESS_FILE FIL)
endif()

set(YRPC_OPTS "")
if (${ARG_MESSAGES})
if (${MESSAGES})
list(APPEND ${SRCS} "${MESSAGES_CC}")
list(APPEND ${HDRS} "${MESSAGES_H}")
list(APPEND OUTPUT_FILES "${MESSAGES_CC}" "${MESSAGES_H}")
Expand Down Expand Up @@ -107,7 +107,7 @@ macro(YRPC_PROCESS_FILE FIL)
"${SERVICE_CC}" "${SERVICE_H}" protoc-gen-insertions
"${PROXY_CC}" "${PROXY_H}")
endif()
if(${ARG_MESSAGES})
if(${MESSAGES})
list(APPEND TGT_DEPS "${MESSAGES_CC}" "${MESSAGES_H}")
endif()
add_custom_target(${TGT_NAME} DEPENDS ${TGT_DEPS})
Expand All @@ -127,7 +127,9 @@ function(YRPC_GENERATE SRCS HDRS TGTS)

set(options)
set(one_value_args SOURCE_ROOT BINARY_ROOT MESSAGES SERVICE)
set(multi_value_args EXTRA_PROTO_PATHS PROTO_FILES NO_SERVICE_PROTO_FILES)
set(multi_value_args
EXTRA_PROTO_PATHS PROTO_FILES MESSAGES_PROTO_FILES NO_SERVICE_PROTO_FILES
NO_SERVICE_MESSAGES_PROTO_FILES)
cmake_parse_arguments(ARG "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})
if(ARG_UNPARSED_ARGUMENTS)
message(SEND_ERROR "Error: unrecognized arguments: ${ARG_UNPARSED_ARGUMENTS}")
Expand Down Expand Up @@ -155,11 +157,17 @@ function(YRPC_GENERATE SRCS HDRS TGTS)
GET_FILENAME_COMPONENT(ARG_BINARY_ROOT ${ARG_BINARY_ROOT} ABSOLUTE)

foreach(FIL ${ARG_PROTO_FILES})
YRPC_PROCESS_FILE(${FIL})
YRPC_PROCESS_FILE("${FIL}" "${ARG_MESSAGES}")
endforeach()
foreach(FIL ${ARG_MESSAGES_PROTO_FILES})
YRPC_PROCESS_FILE("${FIL}" "TRUE")
endforeach()
set(ARG_SERVICE FALSE)
foreach(FIL ${ARG_NO_SERVICE_PROTO_FILES})
YRPC_PROCESS_FILE(${FIL})
YRPC_PROCESS_FILE("${FIL}" "${ARG_MESSAGES}")
endforeach()
foreach(FIL ${ARG_NO_SERVICE_MESSAGES_PROTO_FILES})
YRPC_PROCESS_FILE("${FIL}" "TRUE")
endforeach()

set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
Expand Down
2 changes: 1 addition & 1 deletion src/yb/cdc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ YRPC_GENERATE(
CDC_CONSUMER_YRPC_SRCS CDC_CONSUMER_YRPC_HDRS CDC_CONSUMER_YRPC_TGTS
SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..
BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/../..
NO_SERVICE_PROTO_FILES cdc_consumer.proto)
NO_SERVICE_MESSAGES_PROTO_FILES cdc_consumer.proto)

set(CDC_CONSUMER_YRPC_LIBS
yrpc
Expand Down
Loading

0 comments on commit facc362

Please sign in to comment.