Writing Serialized Protobuf Message directly using gRPC C++ server

112 views
Skip to first unread message

Ashutosh Maheshwari

unread,
Jan 7, 2025, 10:00:51 AMJan 7
to grpc.io
Hello, 

We have implemented a C++ grpc server using grpc::ServerAsyncReaderWriter< W, R > Class.

We are currently using the completion queue mechanism to post the gnmi notifications to sent over gRPC towards the gnmi client. 

We want to get rid of the latency introduced by the deserialization / serialization of the gnmi payload into the protocol message buffer in the grpc stack and rather wish to directly write the serialized protocol message buffer into the grpc stack.

Are there any APIs exposed to gRPC applications ( in this case gnmi) which can be called to post the protocol message buffer (gnmi.proto) without using the gRPC Write which otherwise expects a gnmi::SubscribeResponse object as a tag/payload. 

Regards
Ashutosh

Ashutosh Maheshwari

unread,
Jan 15, 2025, 6:26:56 AMJan 15
to grpc.io
Hello, can anyone please respond on this? 

I am following the recommendation put across the github grpc repo on how to ask a question but I am not observing the attention of the core group members here who could probably answer my question. 

Shall I post my query on some other forum?

Regards
Ashutosh

veb...@google.com

unread,
May 15, 2025, 5:19:33 PMMay 15
to grpc.io
Hi,

You have two potential approaches:

  i) AsyncGenericService (*1): This method allows you to sidestep all serialization and deserialization processes. It's typically the go-to choice when building a proxy.
  ii) Custom serialization (*2): Since gRPC doesn't mandate a specific serializer (like Protobuf), you can opt for a different one. In this case, you would provide already serialized data directly, effectively skipping the serialization step within gRPC.


Regards,
Esun.
Reply all
Reply to author
Forward
0 new messages