Hello, everyone.
I am trying to trace the request sending of gRPC.
In grpc-cpp, when I start to send a request, the client first malloc a buffer, then swap data to it. The tracing log is:
E0816 12:59:37.909413170 6205 slice.cc:309] grpc_slice_malloc() call grpc_slice_malloc_large(), length: 2605
E0816 12:59:37.909489871 6205 call.cc:1519] call_start_batch() start
E0816 12:59:37.909508644 6205 call.cc:1637] call_start_batch(): GRPC_OP_SEND_MESSAGE
E0816 12:59:37.909518989 6205 byte_stream.cc:42] init SliceBufferByteStream()
E0816 12:59:37.909527288 6205 slice_buffer.cc:208] grpc_slice_buffer_swap() start
E0816 12:59:37.909535026 6205 slice_buffer.cc:209] a info: length: 2605, capacity, 8
E0816 12:59:37.909601320 6205 slice_buffer.cc:215] b info: length: 0, capacity, 8
(1) gprc_slice_malloc() first create new space for send_message
(2) GRPC_OP_SEND_MESSAGE operation create SliceBufferByteStream
(3) SliceBufferByteStream call grpc_slice_buffer_swap() to swap memory into its data.
In grpc-python, when I start to send a request, the client invoked grpc_slice_from_copied_buffer() to copy the payload of the request. The tracing log is:
in operation.pyx.pxi, call grpc_slice_from_copied_buffer(), length: 3905
E0816 13:07:32.242668044 7720 slice.cc:216] grpc_slice_from_copied_buffer(), length: 3905
E0816 13:07:32.242682086 7720 slice.cc:309] grpc_slice_malloc() call grpc_slice_malloc_large(), length: 3905
E0816 13:07:32.242703140 7720 call.cc:1519] call_start_batch() start
E0816 13:07:32.242719473 7720 call.cc:1637] call_start_batch(): GRPC_OP_SEND_MESSAGE
E0816 13:07:32.242732400 7720 byte_stream.cc:42] init SliceBufferByteStream()
E0816 13:07:32.242744987 7720 slice_buffer.cc:208] grpc_slice_buffer_swap() start
E0816 13:07:32.242758298 7720 slice_buffer.cc:209] a info: length: 3905, capacity, 8
E0816 13:07:32.242856925 7720 slice_buffer.cc:215] b info: length: 0, capacity, 8
Here, I find that the public API grpc_slice_from_copied_buffer() is called to copy the payload.
I am trying to find the function who invokes "grpc_slice_malloc()" to create a vacant memory for request payload but failed.
I want to know if I miss the grpc_slice_from_copied_buffer() in grpc-cpp?
Best wishes,
Xia Rui