Compression
revenexx is leveraging compression algorithms to both boost the performance of your app and to reduce and optimize bandwidth and storage costs for revenexx developers. This page provides an in-depth explanation of the compression algorithms supported by revenexx for API responses, image transformations, and storage buckets.
API
revenexx supports two primary algorithms for text-based responses: Brotli and Gzip. These algorithms are integral for improving data transfer speeds across the HTTP based APIs, especially when dealing with textual content, which tends to be highly compressible.
- Brotli: Chosen for its superior compression efficiency, especially for smaller files. Brotli performs best in HTTP/2 and HTTP/3 environments, where smaller payloads mean faster transfers and lower bandwidth consumption. Its efficiency also allows for quicker decompression on modern clients.
- Gzip: Gzip remains supported for backward compatibility and for clients that do not yet fully support Brotli. Though Gzip has a lower compression ratio compared to Brotli, it is still a reliable fallback for older browsers and HTTP/1.1 connections.
- Zstd: Zstd offers very high compression ratios and significantly faster decompression speeds, making it ideal for server-to-server communication and large data transfers. While its browser support is limited compared to Brotli and Gzip, Zstd excels in scenarios where performance and efficiency are critical for backend processes.
Conditions
Compression in revenexx is triggered dynamically based on several conditions. This ensures that we only compress data when it is beneficial for performance and that we avoid unnecessary overhead for small payloads or non-textual data.
- MIME types: Only text-based MIME types are eligible for compression. These include:
text/plaintext/csstext/javascriptapplication/javascripttext/htmlapplication/jsonimage/svg+xmlapplication/xml+rss
This selection is based on the nature of these content types being easily compressible, resulting in significant size reductions without loss of information.
- Response size: Compression is applied when the size of the response exceeds 1KB. This threshold has been selected based on testing to minimize the CPU overhead of compression for small payloads, where the gains in bandwidth reduction are negligible.
- Client-side support: Clients indicate their support for specific compression algorithms via the
Accept-EncodingHTTP header. revenexx prioritizes compression based on the following client-provided values:br: Indicates support for Brotli compression.zstd: Indicates support for Zstandard compression.gzip: Indicates support for Gzip compression.identity: Indicates that no compression is supported or requested.
Prioritizations
revenexx prioritizes Brotli over Gzip due to Brotli’s more efficient compression ratio, especially when dealing with text-based content like HTML, CSS, and JSON files. Brotli uses a sliding window dictionary that results in higher compression ratios at slower speeds, but in an HTTP/2 or HTTP/3 environment, the benefits outweigh the costs. Gzip is used as a fallback when Brotli is not supported by the client.
| Algorithm | Ratio | Browsers | Notes |
|---|---|---|---|
| Brotli | High | All modern browsers | Optimal for small text files; highly efficient. |
| Gzip | Medium | Universal | Broad compatibility with older and modern clients. |
| Zstd | Very High | Limited | High performance with faster decompression speeds, ideal for server-to-server communication. |
| Identity | None | Universal | Used when no compression is applied or supported. |
Enabling compression
Compression is enabled by default for eligible API responses in revenexx. You do not need to manually enable it; revenexx dynamically selects the best algorithm based on the client’s Accept-Encoding headers and the MIME type of the response.
Image transformations
revenexx's API supports the compression of image files during manipulation and preview generation. The primary reason for compressing images is to minimize file sizes while maintaining visual quality, thus reducing both bandwidth usage and storage costs.
revenexx supports both legacy and modern image formats, including:
- PNG, JPEG, GIF: These are traditional formats supported for compatibility reasons. PNG supports lossless compression, while JPEG and GIF are lossy but optimized for small sizes.
- WebP: A modern format developed by Google, offering better compression rates than JPEG, PNG, or GIF while maintaining equivalent quality.
- AVIF: The most modern image format supported by revenexx, which offers even higher compression rates than WebP. AVIF is based on the AV1 video codec and is optimized for high-performance image rendering with minimal bandwidth use.
Supported API endpoints
revenexx applies image compression exclusively through the image transform parameters on the delivery URL. Any dynamic operation — resizing images or converting between formats — is optimized for performance and reduced file size. Images you upload stay in their original format and quality, so your source of truth is preserved.
Prioritization
revenexx does not apply any image compression by default. You have full control over the output by specifying it in the query string of the delivery URL. This allows for precise customization to suit various use cases.
revenexx supports modern image formats like WebP and AVIF for their exceptional compression rates and compatibility with most browsers. While WebP is often the default choice for conversions, AVIF is recommended when seeking optimal performance and minimal file sizes.
You choose the output format by adding transform parameters to the delivery URL — the edge applies the conversion and compression at request time, then caches the result. Request a WebP variant resized to 1800 px wide:
https://storage.revenexx.com/<TENANT_SLUG>/photos/sunset.png?w=1800&fm=webp&q=90
fm selects the output format (webp, avif, jpg, png) and q sets the quality. See Serve and transform images for the full parameter list.
| Algorithm | Formats | Ratio | Notes |
|---|---|---|---|
| WebP | PNG, JPEG, GIF | High | Great balance of compression efficiency and visual quality |
| AVIF | PNG, JPEG, GIF | Best | Highest compression rate for modern use cases |
| JPEG | JPEG | Medium | Legacy support for lossy compression |
| PNG | PNG | Lossless | Necessary for lossless compression requirements |
Enabling compression
You enable image compression by specifying the desired output format on the delivery URL. For example, requesting a WebP or AVIF conversion automatically triggers revenexx's compression algorithms to optimize the image size.