This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Description
Context
In current implementation we define type per message in NeoFS API in order to:
- do not tie the transport logic to
gRPC
lib
- implement stable serialization (Protocol Buffers with direct field order)
Given the need to serialize messages for signatures and the like, we can try to skip the extra conversion+serialization step (ToGRPCMessage
methods) of the gRPC
library utilities and pass the messages directly in binary form (our serialization follows Protocol Buffers).
Proposal
Research direct transmission of message types on the example of some request and pay attention on the optimality criterion:
- memory overhead on extra conversion
- network (and any other) overhead without an extra conversion
- if the rejection of additional conversion will show a decent performance gain, how much will it be necessary to change and maintain the library API
It is worth mentioning that the results directly depend on the selected versions of the libraries: current and gRPC
.
For experimentation, I propose to implement a test scenario based on a fake connection (net.Conn
), which will allow you to calculate the amount of transmitted traffic (at least from the application side).
type fakeConn struct {
net.Conn
traffic int
}
func (x *fakeConn) Write(p []byte) (int, error) {
n := len(p)
x.traffic += n
return n, nil
}