[
https://issues.apache.org/jira/browse/HDDS-17916?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chu Cheng Li updated HDDS-17916:
--------------------------------
Description:
Currently, performing a seek on a key triggers a {{GetBlock}} request for
_every_ block associated with that key, rather than just the specific block
being read. Because the S3 Gateway (S3G) performs a seek for every range GET
request, a range GET on a multipart object ends up costing one {{GetBlock}}
request per part.
To put this in perspective: a small 4 KiB range GET on an object with 16 parts
will unnecessarily send 16 {{GetBlock}} requests, whereas the same operation on
a single-block object only sends one.
*Cause:* This happens because {{MultipartInputStream.initialize()}} eagerly
calls {{BlockInputStream.initialize()}} across all blocks (behavior introduced
in HDDS-11220). However, this initialization is really only necessary for
under-construction blocks so we can fetch their exact length from the DataNode.
For all other finalized blocks, the Ozone Manager (OM) already knows their
lengths.
*Proposed Solution:* During a seek, we should only initialize blocks that are
actively under construction. The remaining blocks can lazily initialize upon
their first read. Notably, {{StreamBlockInputStream}} already handles this
correctly.
_Note: We spotted this issue while working with Flink ForSt state on S3
(HDDS-17894), which heavily relies on small range GETs to read multipart SST
files._
was:
A seek on a key sends one GetBlock for every block of the key, not only for the
block it reads. S3G seeks for every range GET, so a range GET on a multipart
object costs one GetBlock for each part.
Example: a 4 KiB range GET on an object with 16 parts sends 16 GetBlock
requests. The same GET on a single-block object sends 1.
Cause: {{MultipartInputStream.initialize()}} calls
{{BlockInputStream.initialize()}} on all blocks (HDDS-11220). Only an
under-construction block needs this, to get its length from the datanode. OM
already has the length of the other blocks.
Proposal: at seek, initialize only an under-construction block. The other
blocks initialize on first read. {{StreamBlockInputStream}} already works this
way.
Found with Flink ForSt state on S3 (HDDS-17894), which reads multipart SST
files with small range GETs.
> Seek on a multi-block key sends GetBlock for every block
> --------------------------------------------------------
>
> Key: HDDS-17916
> URL: https://issues.apache.org/jira/browse/HDDS-17916
> Project: Apache Ozone
> Issue Type: Improvement
> Components: Ozone Client
> Reporter: Chu Cheng Li
> Assignee: Chu Cheng Li
> Priority: Major
> Labels: pull-request-available
>
> Currently, performing a seek on a key triggers a {{GetBlock}} request for
> _every_ block associated with that key, rather than just the specific block
> being read. Because the S3 Gateway (S3G) performs a seek for every range GET
> request, a range GET on a multipart object ends up costing one {{GetBlock}}
> request per part.
> To put this in perspective: a small 4 KiB range GET on an object with 16
> parts will unnecessarily send 16 {{GetBlock}} requests, whereas the same
> operation on a single-block object only sends one.
>
> *Cause:* This happens because {{MultipartInputStream.initialize()}} eagerly
> calls {{BlockInputStream.initialize()}} across all blocks (behavior
> introduced in HDDS-11220). However, this initialization is really only
> necessary for under-construction blocks so we can fetch their exact length
> from the DataNode. For all other finalized blocks, the Ozone Manager (OM)
> already knows their lengths.
>
> *Proposed Solution:* During a seek, we should only initialize blocks that are
> actively under construction. The remaining blocks can lazily initialize upon
> their first read. Notably, {{StreamBlockInputStream}} already handles this
> correctly.
>
> _Note: We spotted this issue while working with Flink ForSt state on S3
> (HDDS-17894), which heavily relies on small range GETs to read multipart SST
> files._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]