rfc9659v2.txt   rfc9659.txt 
Internet Engineering Task Force (IETF) N. Jaju, Ed. Internet Engineering Task Force (IETF) N. Jaju, Ed.
Request for Comments: 9659 Google Request for Comments: 9659 Google
Updates: 8878 F. Handte, Ed. Updates: 8878 W. F. Handte, Ed.
Category: Informational Meta Platforms, Inc. Category: Informational Meta Platforms, Inc.
ISSN: 2070-1721 September 2024 ISSN: 2070-1721 September 2024
Window Sizing for Zstandard Content Encoding Window Sizing for Zstandard Content Encoding
Abstract Abstract
Deployments of Zstandard, or "zstd", can use different window sizes Deployments of Zstandard, or "zstd", can use different window sizes
to limit memory usage during compression and decompression. Some to limit memory usage during compression and decompression. Some
browsers and user agents limit window sizes to mitigate memory usage browsers and user agents limit window sizes to mitigate memory usage
skipping to change at line 75 skipping to change at line 75
compression mechanism similar to gzip. When used with HTTP, the compression mechanism similar to gzip. When used with HTTP, the
"zstd" content coding token signals to the decoder that the content "zstd" content coding token signals to the decoder that the content
is Zstandard-compressed. is Zstandard-compressed.
An important property of Zstandard-compressed content is its An important property of Zstandard-compressed content is its
Window_Size ([RFC8878], Section 3.1.1.1.2), which describes the Window_Size ([RFC8878], Section 3.1.1.1.2), which describes the
maximum distance for back-references and therefore how much of the maximum distance for back-references and therefore how much of the
content must be kept in memory during decompression. content must be kept in memory during decompression.
The minimum Window_Size is 1 KB. The maximum Window_Size is (1<<41) The minimum Window_Size is 1 KB. The maximum Window_Size is (1<<41)
+ 7*(1<<38) bytes, which is 3.75 TB. Larger Window_Size values tend + 7*(1<<38) bytes, where "<<" denotes a bitwise left shift, which is
to improve the compression ratio but at the cost of increased memory 3.75 TB. Larger Window_Size values tend to improve the compression
usage. ratio but at the cost of increased memory usage.
To protect against unreasonable memory usage, some browsers and user To protect against unreasonable memory usage, some browsers and user
agents limit the maximum Window_Size they will handle. This causes agents limit the maximum Window_Size they will handle. This causes
failures to decode responses when the content is compressed with a failures to decode responses when the content is compressed with a
larger Window_Size than the recipient allows, leading to decreased larger Window_Size than the recipient allows, leading to decreased
interoperability. interoperability.
[RFC8878], Section 3.1.1.1.2 recommends that decoders support a [RFC8878], Section 3.1.1.1.2 recommends that decoders support a
Window_Size of up to 8 MB, and that encoders not generate frames Window_Size of up to 8 MB, and that encoders not generate frames
using a Window_Size larger than 8 MB. However, it imposes no using a Window_Size larger than 8 MB. However, it imposes no
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.48.