[ 
https://issues.apache.org/jira/browse/SLING-5991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15729181#comment-15729181
 ] 

Timothee Maret commented on SLING-5991:
---------------------------------------

Thanks [~teofili] & [~simone.tripodi] for looking at this and detailing the 
reason for the {{FileBackedMemoryOutputStream}}.

bq. Would you have any suggestions ?

IIUC currently the flow involves the following _sequential_ steps:

0. Buffer the whole package to a {{FileBackedMemoryOutputStream}} using the 
signature {{ResourceDistributionPackageBuilder#exportToStream}}.
1. Get an InputStream from the FileBackedMemoryOutputStream written at pt. 0 
and upload the stream in the repository (persisting for further queue 
processing) via DistributionPackageUtils#uploadStream

Unless I miss-read it, the point 1. can only start after the entire package is 
entirely buffered.
This would introduce the latency I was referring to.

My suggestion would be to drop that latency, by doing 0. and 1. in parallel.

> [SCD] Evaluate avoiding to buffer the whole packages before streaming
> ---------------------------------------------------------------------
>
>                 Key: SLING-5991
>                 URL: https://issues.apache.org/jira/browse/SLING-5991
>             Project: Sling
>          Issue Type: Improvement
>          Components: Distribution
>    Affects Versions: Content Distribution 0.2.0
>            Reporter: Timothee Maret
>            Assignee: Tommaso Teofili
>             Fix For: Content Distribution 0.2.0
>
>
> As described in SLING-5990, It seems streaming only starts when the whole 
> binary is completely buffered (in memory and/or file). The buffering time 
> implies a latency which which could be avoided by streaming directly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to