HDDS-2467. Allow running Freon validators with limited memory#152
HDDS-2467. Allow running Freon validators with limited memory#152dineshchitlangia merged 2 commits intoapache:masterfrom
Conversation
|
|
||
| // force stream if key is too large for byte[] | ||
| // (limit taken from ByteArrayOutputStream) | ||
| if (referenceKeySize > Integer.MAX_VALUE - 8) { |
There was a problem hiding this comment.
You can force this much sooner, say 1 GB ? or even 100MB. Otherwise, the virtual memory reservation would be huge.
And practically, does it matter?
There was a problem hiding this comment.
Any lower limit would be arbitrary. Actual memory requirement depends on the number of threads. One can always add the flag explicitly. I just wanted to preserve existing behavior as a courtesy.
Hope that makes sense :)
anuengineer
left a comment
There was a problem hiding this comment.
+1. LGTM. I have a minor comment, you can fix that in some other JIRA too. if I commit this patch before you get a chance to see my comment.
dineshchitlangia
left a comment
There was a problem hiding this comment.
@adoroszlai thanks for the contribution, @anuengineer thanks for the review.
|
Thanks @anuengineer the review and @dineshchitlangia for review/merge. |
…e manager double buffer batch (apache#7188) (apache#152) (cherry picked from commit 5feb9ea) Change-Id: Iee80b0b1aef2a7585b45c60d3826c08a9c926247 Co-authored-by: Swaminathan Balachandran <swamirishi.sb@gmail.com>
What changes were proposed in this pull request?
byte[]buffer. This allows timing only the read (and buffer allocation), but not the subsequent digest calculation. However, it also means that memory required for running the validators is proportional to key size. I propose to add a command-line flag (-s/--stream) which, when specified, makes Freon calculate the digest while reading the input stream. This changes timing results a bit, since values will include the time required for digest calculation. On the other hand, Freon will be able to validate huge keys with limited memory.ByteArrayOutputStream, which allocates incrementally larger and larger buffers. The latter can lead to memory requirement twice the actual key size in the worst case (since2^n > 2^n-1 + 2^n-2 + ...).SameKeyReaderandOzoneClientKeyValidator.OzoneClientKeyGeneratorto create > 2GB keys.https://issues.apache.org/jira/browse/HDDS-2467
How was this patch tested?
Created and validated keys using Freon. Verified that even 2.5GB key can be created and validated with
--stream. Verified that streaming is forced for such a large key, since it won't fit any array. Verified that smaller keys can be validated both ways.