Do not marshal the same object twice in PutSingle #531

Closed
opened 2023-07-19 14:48:17 +00:00 by fyrchik · 2 comments
Owner

It rubs me wrong way, when I see the same object being repeatedly marshaled just to be sent to different clients. It is the same. Consider PutSingle: we receive a message which contains perfectly valid object, we need to unmarshal it (for validation), but that's all: the same bytes should be both put in the local storage and sent to other clients.
Another thing is payload: marshaled + unmarshaled form take twice as much space as just an object, because the payload is copied (needs verification).

I believe we can do better.
In this task:

  1. Investigate whether there are non-invasive solutions for this kind of task: we do not want to use tricky solutions in the frostfs-api-go.
  2. Investigate whether gRPC codecs could be helpful (raw API client can be used in this single case, because SDK client has typed parameters).

Ideally we would like to have a single slice with the same lifetime as PutSingle RPC (currently its 3x overhead for REP 2, even more for a simple Put).

We will decide what the next step is after research.

Related #463

It rubs me wrong way, when I see the same object being repeatedly marshaled just to be sent to different clients. It _is_ the same. Consider `PutSingle`: we receive a message which contains perfectly valid object, we need to unmarshal it (for validation), but that's all: the same bytes should be both put in the local storage and sent to other clients. Another thing is payload: marshaled + unmarshaled form take twice as much space as just an object, because the payload is copied (needs verification). I believe we can do better. In this task: 1. Investigate whether there are non-invasive solutions for this kind of task: we do not want to use tricky solutions in the frostfs-api-go. 2. Investigate whether gRPC codecs could be helpful (raw API client can be used in this single case, because SDK client has typed parameters). Ideally we would like to have a single slice with the same lifetime as `PutSingle` RPC (currently its 3x overhead for `REP 2`, even more for a simple `Put`). We will decide what the next step is after research. Related #463
fyrchik added the
enhancement
discussion
frostfs-node
triage
labels 2023-07-19 14:48:17 +00:00
fyrchik added this to the v0.37.0 milestone 2023-07-19 14:51:22 +00:00
Author
Owner

Verification/signing is another thing that could benefit.

Verification/signing is another thing that could benefit.
fyrchik self-assigned this 2023-07-31 08:09:13 +00:00
fyrchik modified the milestone from v0.37.0 to v0.38.0 2023-08-29 09:10:14 +00:00
dstepanov-yadro self-assigned this 2023-11-02 14:24:24 +00:00

Memory allocations reduced by drop redundant unmarshals

Memory allocations reduced by drop redundant `unmarshal`s
Sign in to join this conversation.
No milestone
No project
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#531
No description provided.