Verify data integrity in parallel with response streaming #1499

Open
opened 2024-11-15 10:31:19 +00:00 by potyarkin · 0 comments
Member

Currently frostfs-node does not perform any data integrity verification when it streams objects to client from disk. As far as I know, we had this feature previously and have disabled it for performance reasons (iirc, memory usage and latency considerations). By streaming data directly from disk to network we avoid putting large objects into memory and minimize the time to first byte.

Responsibility for bitrot protection is currently delegated to client (app developer): discussion in private chat.

Describe the solution you'd like

Let's discuss whether it's possible to add integrity verification back:

  • Can we send an error (disk i/o error, integrity verification error) not before the first byte but after/during data stream?
  • If that would be possible we could run hash calculation in a parallel subroutine: read data from disk just once, in small chunks, and then send each chunk both to the client connection and to the hasher.
  • If hasher detects an error the data stream would be interrupted/restarted from another replica (that's up to discussion).

This approach would introduce some CPU overhead for hashing but would be pretty cheap in terms of memory and latency. TTFB would not be affected at all.

This suggestion is inspired in part by structured replies in NBD protocol. They were introduced to solve a similar problem there.

Describe alternatives you've considered

Keep things as they are: no bitrot protection, data integrity verification delegated to client.

## Is your feature request related to a problem? Please describe. Currently frostfs-node does not perform any data integrity verification when it streams objects to client from disk. As far as I know, we had this feature previously and have disabled it for performance reasons (iirc, memory usage and latency considerations). By streaming data directly from disk to network we avoid putting large objects into memory and minimize the time to first byte. Responsibility for bitrot protection is currently delegated to client (app developer): [discussion in private chat](https://chat.yadro.com/yadro/pl/t4nn3quwcpf9zy3n67c7uad9nc). ## Describe the solution you'd like Let's discuss whether it's possible to add integrity verification back: - Can we send an error (disk i/o error, integrity verification error) not before the first byte but after/during data stream? - If that would be possible we could run hash calculation in a parallel subroutine: read data from disk just once, in small chunks, and then send each chunk both to the client connection and to the hasher. - If hasher detects an error the data stream would be interrupted/restarted from another replica (that's up to discussion). This approach would introduce some CPU overhead for hashing but would be pretty cheap in terms of memory and latency. TTFB would not be affected at all. This suggestion is inspired in part by [structured replies](https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md#structured-reply-chunk-message) in NBD protocol. They were introduced to solve a similar problem there. ## Describe alternatives you've considered Keep things as they are: no bitrot protection, data integrity verification delegated to client.
potyarkin added the
enhancement
discussion
frostfs-node
P3
triage
labels 2024-11-15 10:31:19 +00:00
fyrchik removed the
P3
label 2024-11-15 10:34:43 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#1499
No description provided.