Re: [Hls-interest] LL-HLS Amendment Proposal: Optional part response headers for CDN efficiency.

Jan Van Doorn <jvd@apple.com> Mon, 15 February 2021 16:34 UTC

Return-Path: <jvd@apple.com>
X-Original-To: hls-interest@ietfa.amsl.com
Delivered-To: hls-interest@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 93B7F3A0D45 for <hls-interest@ietfa.amsl.com>; Mon, 15 Feb 2021 08:34:53 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.757
X-Spam-Level:
X-Spam-Status: No, score=-0.757 tagged_above=-999 required=5 tests=[DKIMWL_WL_HIGH=-0.57, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, T_REMOTE_IMAGE=0.01, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=apple.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5zYwC7FKGJMx for <hls-interest@ietfa.amsl.com>; Mon, 15 Feb 2021 08:34:50 -0800 (PST)
Received: from nwk-aaemail-lapp02.apple.com (nwk-aaemail-lapp02.apple.com [17.151.62.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 8EE7D3A0D41 for <hls-interest@ietf.org>; Mon, 15 Feb 2021 08:34:50 -0800 (PST)
Received: from pps.filterd (nwk-aaemail-lapp02.apple.com [127.0.0.1]) by nwk-aaemail-lapp02.apple.com (8.16.0.43/8.16.0.42) with SMTP id 11FGPodE034830; Mon, 15 Feb 2021 08:34:47 -0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=from : message-id : content-type : mime-version : subject : date : in-reply-to : cc : to : references; s=20180706; bh=0JY70COIiLAdAdbs/25kCG3I9E9mM0lFQGuWxzpWazI=; b=THYtB4R7Nsrd0KsM8bF5amLkFi0fTZdnGDXRd3rzYUshNPQFHFqRWZ6uiphRGvUz3I96 kErWiADKNsDTr2kZh//1aEnrSCay2mSW9atI3YMOvH72OgDl1njo5F+Ow+jDN/FRUXM/ PWyw1FyDy888XNayukiXSuE50rLF/O8qTO/PiJP27UsOjh46g2yU3RjUPru9X9aWy+CG BjwsE/X/UQCmPimb2eELjH/gZQSFH702DlBAvYdDElUeIbQbEGRtx2JoYD2Ujmehx070 vrs8GFFjMwRcLlYArByxkGYHOwWu7yASfFvgvx28z+SAztiKqZtZ14cx/eL+92L28zd8 Ug==
Received: from ma-mailsvcp-mta-lapp01.corp.apple.com (ma-mailsvcp-mta-lapp01.corp.apple.com [10.226.18.133]) by nwk-aaemail-lapp02.apple.com with ESMTP id 36pc7ktubg-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Mon, 15 Feb 2021 08:34:47 -0800
Received: from ma-mailsvcp-mmp-lapp03.apple.com (ma-mailsvcp-mmp-lapp03.apple.com [17.32.222.16]) by ma-mailsvcp-mta-lapp01.corp.apple.com (Oracle Communications Messaging Server 8.1.0.7.20201203 64bit (built Dec 3 2020)) with ESMTPS id <0QOK00XJVWPYDZ40@ma-mailsvcp-mta-lapp01.corp.apple.com>; Mon, 15 Feb 2021 08:34:46 -0800 (PST)
Received: from process_milters-daemon.ma-mailsvcp-mmp-lapp03.apple.com by ma-mailsvcp-mmp-lapp03.apple.com (Oracle Communications Messaging Server 8.1.0.7.20201203 64bit (built Dec 3 2020)) id <0QOK00900WGJ3X00@ma-mailsvcp-mmp-lapp03.apple.com>; Mon, 15 Feb 2021 08:34:46 -0800 (PST)
X-Va-A:
X-Va-T-CD: 81ca60fce39c2560b6c4a7e5841f9b8f
X-Va-E-CD: 0a393ce9ee259957647fa08db545ee71
X-Va-R-CD: b6da29ba28c35527f9c2525e4f5a8bc3
X-Va-CD: 0
X-Va-ID: 229035b5-83e6-4733-853d-d69cbcc13e1f
X-V-A:
X-V-T-CD: 81ca60fce39c2560b6c4a7e5841f9b8f
X-V-E-CD: 0a393ce9ee259957647fa08db545ee71
X-V-R-CD: b6da29ba28c35527f9c2525e4f5a8bc3
X-V-CD: 0
X-V-ID: 1532f406-a741-4842-a9ae-997c9f2f8ebd
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-02-15_11:2021-02-12, 2021-02-15 signatures=0
Received: from smtpclient.apple (unknown [17.234.164.191]) by ma-mailsvcp-mmp-lapp03.apple.com (Oracle Communications Messaging Server 8.1.0.7.20201203 64bit (built Dec 3 2020)) with ESMTPSA id <0QOK00D3PWPW9600@ma-mailsvcp-mmp-lapp03.apple.com>; Mon, 15 Feb 2021 08:34:45 -0800 (PST)
From: Jan Van Doorn <jvd@apple.com>
Message-id: <863DA51C-6758-4B01-BB81-1DCE078120FD@apple.com>
Content-type: multipart/signed; boundary="Apple-Mail=_C84D1B7B-DDDF-4077-AEDE-7FD5DD58F422"; protocol="application/pkcs7-signature"; micalg="sha-256"
MIME-version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.10\))
Date: Mon, 15 Feb 2021 09:34:44 -0700
In-reply-to: <21cc4a753f0c46189ada6f8e3e177516@EX13D02EUB003.ant.amazon.com>
Cc: "Law, Will" <wilaw=40akamai.com@dmarc.ietf.org>, "hls-interest@ietf.org" <hls-interest@ietf.org>
To: "Weil, Nicolas" <nicoweil@elemental.com>
References: <21cc4a753f0c46189ada6f8e3e177516@EX13D02EUB003.ant.amazon.com>
X-Mailer: Apple Mail (2.3654.80.0.2.10)
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-02-15_11:2021-02-12, 2021-02-15 signatures=0
Archived-At: <https://mailarchive.ietf.org/arch/msg/hls-interest/XzmkH5hQuvrMcFcgpc1VIxzTUXA>
Subject: Re: [Hls-interest] LL-HLS Amendment Proposal: Optional part response headers for CDN efficiency.
X-BeenThere: hls-interest@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Discussions about HTTP Live Streaming \(HLS\)." <hls-interest.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/hls-interest>, <mailto:hls-interest-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/hls-interest/>
List-Post: <mailto:hls-interest@ietf.org>
List-Help: <mailto:hls-interest-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hls-interest>, <mailto:hls-interest-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Feb 2021 16:34:54 -0000

One of the original LL-HLS design goals was to scale with regular CDNs and not require anything other than HTTP/2 on the caches. I think CDNs work best when they just implement the HTTP spec. I think that is a strong reason to not implement edge stitching as well.

Rgds,
JvD


> On Feb 12, 2021, at 6:11 PM, Weil, Nicolas <nicoweil@elemental.com> wrote:
> 
> From the origin perspective, I would add that we’d have a strong reason to not implementing it: the edge stitching dilutes responsibility and makes it impossible to debug efficiently when things start to go wrong.
>  
> I would rather propose that origins add a specific header to the last part of a full segment, with the name of it, so that CDNs can prefetch the full segment and provide the best delivery performance possible – something like hls-fullsegment-prefetch: vid720_segment_1521.m4v
>  
> This would work well with ad insertion discontinuities and preserve a clear split of the responsibilities between the origin and the CDN.
>  
> Thanks,
> Nicolas
> ----------------
> Nicolas Weil | Senior Product Manager – Media Services
> AWS Elemental
>  
> From: Hls-interest <hls-interest-bounces@ietf.org <mailto:hls-interest-bounces@ietf.org>> On Behalf Of Law, Will
> Sent: Friday, February 12, 2021 2:28 PM
> To: hls-interest@ietf.org <mailto:hls-interest@ietf.org>
> Subject: RE: [Hls-interest] LL-HLS Amendment Proposal: Optional part response headers for CDN efficiency.
>  
> Hi Roger
>  
> From an Akamai perspective, we acknowledge the issue raised by Andrew, in that duplicate parts and segments reduce cache efficiency at the edge. This is something the HLS community should strive to reduce over time. I have four main responses to this proposal.
>  
> Firstly, we feel that the existing HLS spec <https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-08> already provides a solution to this problem, namely the use of byte-range addressing for parts. Under this addressing mode, the only objects the origin produces are segments. These are the single objects that are cached at the edge. The use of ranges to retrieve parts affords the clients the ability to lower their latency below the segment duration and to start and switch quickly. This approach has the following advantages over edge-stitching :
>  
> Segment caching and byte-range delivery is natively supported by any CDN which supports Http2 delivery. It does not need to be taught new behaviors (RFC8673 edge case aside). One of the secrets to HLS success has been the simplicity of scaling it out. Any http server has sufficed in the past. In introducing edge stitching, we are moving to more of a Smooth streaming model, which places a dependency on logic at the edge. This logic has to be implemented consistently across multiple CDNs and introduces critical path complexity which has to be managed.
> Edge stitching has an overhead cost, mainly in directory searches to discover aggregate parts. Searches are always more expensive than lookups since you must span the whole directory tree. This compute cost would have to be absorbed by the CDN. Edge stitching is basically trading cache efficiency for compute. Byte-range does not force you to make this trade-off.
>  
> Secondly, the period time in which we have duplicate cache content is not actually that long. Per the HLS spec, blocking media objects requests (such as parts) should be cached for 6 target durations (basically a 100% safety factor since they are only described for the last 3 target durations of the streams). For 4s segments, this means we can evict our stored parts after 24s. The media segments, which can be requested by standard latency clients and as well as low latency clients scrubbing behind live, need to be cached longer. 
>  
> Consider the case of a live stream with 4s segments and 1s part durations.
>  
> After 40s of streaming, we have
> 10 media segments holding 40s of data in the cache
> 24s of duplicate part data
> The overall cache duplication is 24/40  = 60%
>  
> After 5mins (300s) of streaming, we have
> 300s of media segments in the cache
> 24s of duplicate part data
> The overall cache duplication is 24/300  = 8%
>  
> After 30mins (1800s) of streaming, we have
> 1800s of media segments in the cache
> 24s of duplicate part data
> The overall cache duplication is 24/1800  = 1.3%
>  
> So streams with realistic durations in the minutes actually have quite a low percentage of duplicate data, as long as the CDN is aggressive about cache eviction and the origin does a good job in setting cache-control headers.
>  
> Thirdly, at Akamai we would have a complex time in implementing the edge stitching as proposed and the same may be true for other CDNs. The reason is that while the origin header information gets written in to our cache store entry table, the store tables are architected to very efficiently tell you if an object exists and if so, to return it. They are not databases optimized for horizontal searching. We cannot search across the cache, for example asking for all objects whose X-HLS-Part-Root-Segment header matches a certain string. It would very difficult to implement the edge stitch proposed here. We would need to externalize the header information in to some sort of parallel database which we could query. While we have such structures (via EdgeWorkers and EdgeKV), their use would raise the cost and complexity of delivering LL-HLS. At that point we would probably choose to suffer the low duplication rates and instead focus on efficiently evicting parts.
>  
> Fourthly, if the community opinion is to still proceed with this edge-stitch plan, then I would offer the following suggestions:
> 1.       To avoid header bloat, the sequence and offset headers could be collapsed into a single header, for example HLS-Part-Info:<current-part>,<total-part-count>,<byte-offset. This would look like HLS-Part-Info:2,8,623751. Due to HPACK and QPACK header compression, we would not want to place the root-segment in the same bundle, as it will be invariant over the parts from the same segment and hence can be compressed more efficiently if it is separate.
> 2.       The IETF strongly discourages the use of X- in header prefixes <https://tools.ietf.org/html/rfc6648>. A simple header name such as ‘HLS-part-info’ would be preferable.
> 3.       Do you need both byte offset and sequence? Once you know the sequence, you can read the byte-lengths from the individually stored parts.
> 4.       Segments get truncated without warning, often for ad insertion discontinuities and always at the end when the encoder is turned off.  Say you are making 8 parts per 4s segment and have sent off the first two parts to the CDN before reaching a sudden discontinuity. You have labelled these as 1/8 and 2/8 respectively. Since 3-8 are never produced, the edge routine would waste some time and resources looking for 3-8, before giving up and going to the origin to fetch the segment. Performance – especially TTFB and apparent throughput – would suffer.
> 5.       You may have an edge server which is only serving legacy clients pulling segments and no low-latency clients seeding the edge with part requests. In this case, the edge would waste time searching for constituent parts before giving up and going to the origin to fetch the segment. Performance again would suffer. 
>  
> I appreciate Limelight raising these issues and look forward to debating a mutually efficient solution which benefits content distributors, CDNs and players.
>  
> Have a good long weekend!
>  
> Cheers
> Will
>  
>  
> --------------------------------------------------------
> Chief Architect – Edge Technology Group
> Akamai Technologies
> San Francisco
> Cell: +1.415.420.0881
>  
>  
>  
>  
>  
>  
>  
> From: Roger Pantos <rpantos=40apple.com@dmarc.ietf.org <mailto:rpantos=40apple.com@dmarc.ietf.org>>
> Date: Friday, February 12, 2021 at 10:40 AM
> To: Andrew Crowe <acrowe=40llnw.com@dmarc.ietf.org <mailto:acrowe=40llnw.com@dmarc.ietf.org>>
> Cc: "hls-interest@ietf.org <mailto:hls-interest@ietf.org>" <hls-interest@ietf.org <mailto:hls-interest@ietf.org>>
> Subject: Re: [Hls-interest] LL-HLS Amendment Proposal: Optional part response headers for CDN efficiency.
>  
>  
>  
> 
> On Feb 9, 2021, at 7:54 AM, Andrew Crowe <acrowe=40llnw.com@dmarc.ietf.org <mailto:acrowe=40llnw.com@dmarc.ietf.org>> wrote:
>  
> Hello,
> 
> CMAF content packaged and delivered using LL-DASH and range-based LL-HLS are easily managed as duplicate content by CDNs as they specify only segment files. In fact, once the segment is complete, it can then be served out of CDN cache for players that are not Low Latency capable - effectively reducing latency for them as well. Part-based LL-HLS introduces individually named part files that then collapse to the separately named segment file upon final part completion. This then means that on first request for the whole collapsed segment file the CDN will have to go back to origin to request bytes that it likely already has in the individually named part files. CDNs can improve cache efficiency, origin hit rate, and whole segment delivery times with a little bit of additional information from origin.
> 
> 
> On request for a named part file an origin may provide a set of response headers:
> 
> *X-HLS-Part-Sequence*
> A multi value header that represents the current part sequence (index=1) and the total number of parts for the segment. The values will be separated by a forward slash ("/"). For example a 2 second segment with 8 parts per segment will respond to the 2nd part request (vid720_segment_1521.part2.m4v) like
> X-HLS-Part-Sequence: 2/8
> 
> 
> *X-HLS-Part-Offset*
> A single value header that represents the byte offset of the part in the segment. The first part of a segment will always be 0 while, for example the second .25s part of a 2mpbs stream (vid720_segment_1521.part2.m4v) may have a value like 623751
> 
> 
> *X-HLS-Part-Root-Segment*
> A single value header that provides the name of the root segment of the current part. This lets the CDN/proxy know which root file to concatenate the parts into. vid720_segment_1521.part2.m4v would have a value of vid720_segment_1521.m4v
> 
> 
> With the information from these three headers the CDN can recognize the individually named part files as ranges of a larger file, store them effectively and deliver a better experience to viewers across all formats. 
>  
> Hello Andrew. I’m interested in this proposal, but I’d also like to hear some feedback from others in the CDN and packager spaces. Specifically, I’d like to know if other folks:
>  
> - Agree that it’s a good way to solve the problem
>  
> - Can spot any problems or limitations in this proposal that might make it difficult to produce (or consume) these headers
>  
> - Can see themselves implementing it
>  
>  
> thanks,
>  
> Roger Pantos
> Apple Inc.
>  
> 
> 
> Regards,
> -Andrew
> -- 
>  <https://urldefense.com/v3/__https:/www.limelight.com/__;!!GjvTz_vk!Gcp-s1jYCIAYpNsmuK09dLU1cDo5FUINbvdFY1ZXSct8lPTh9xqsUiZS1ril$>
> Andrew Crowe Architect
> EXPERIENCE FIRST.
> +1 859 583 3301 <tel:+1+859+583+3301>
> www.limelight.com <https://urldefense.com/v3/__https:/www.limelight.com/__;!!GjvTz_vk!Gcp-s1jYCIAYpNsmuK09dLU1cDo5FUINbvdFY1ZXSct8lPTh9xqsUiZS1ril$>
>  <https://urldefense.com/v3/__https:/www.facebook.com/LimelightNetworks__;!!GjvTz_vk!Gcp-s1jYCIAYpNsmuK09dLU1cDo5FUINbvdFY1ZXSct8lPTh9xqsUqon8WvN$> <https://urldefense.com/v3/__https:/www.linkedin.com/company/limelight-networks__;!!GjvTz_vk!Gcp-s1jYCIAYpNsmuK09dLU1cDo5FUINbvdFY1ZXSct8lPTh9xqsUgrrsizx$> <https://urldefense.com/v3/__https:/twitter.com/llnw__;!!GjvTz_vk!Gcp-s1jYCIAYpNsmuK09dLU1cDo5FUINbvdFY1ZXSct8lPTh9xqsUvWN2UYO$>
>  
> -- 
> Hls-interest mailing list
> Hls-interest@ietf.org <mailto:Hls-interest@ietf.org>
> https://www.ietf.org/mailman/listinfo/hls-interest <https://www.ietf.org/mailman/listinfo/hls-interest>
>  
> 
> -- 
> Hls-interest mailing list
> Hls-interest@ietf.org <mailto:Hls-interest@ietf.org>
> https://www.ietf.org/mailman/listinfo/hls-interest <https://www.ietf.org/mailman/listinfo/hls-interest>