Liking cljdoc? Tell your friends :D

co.multiply.tropical.compression

Compressing a tab's stream, which an app opts into with :compression (co.multiply.tropical.ring): the encodings, how a request's is chosen, and the encoder each opens over the response.

  • :zstd Zstandard, through the libzstd tropical ships (co.multiply.tropical.sse.ZstdEncoder).
  • :br Brotli, through the libbrotlienc tropical ships (co.multiply.tropical.sse.BrotliEncoder).
  • :gzip gzip, from the JDK.

A stream's encoder lives as long as the stream, and keeps what it sent before as its window: a frame repeating what an earlier one sent, as a morph of an island mostly does, is sent as a reference to it. The frame's events are flushed through the encoder at once, so the client decodes the frame as it arrives.

The settings are tropical's, measured on streams of frames (see the logbook), not the app's to tune. Each is a trade of memory for how far back the window reaches, held for every open stream:

  • :zstd level 3, a 256 KiB window: about 0.7 MB a stream.
  • :br quality 4, a 128 KiB window: about 0.9 MB a stream.
  • :gzip the JDK's default level, and gzip's 32 KiB window: about 0.25 MB a stream. A morph of an island larger than the window is compressed on its own, without reference to its last.

The native libraries are tropical's: an encoding is loaded when the app names it, and ring/handler throws for one it can't load.

Compressing a tab's stream, which an app opts into with `:compression`
(`co.multiply.tropical.ring`): the encodings, how a request's is chosen, and
the encoder each opens over the response.

- `:zstd`  Zstandard, through the libzstd tropical ships
           (`co.multiply.tropical.sse.ZstdEncoder`).
- `:br`    Brotli, through the libbrotlienc tropical ships
           (`co.multiply.tropical.sse.BrotliEncoder`).
- `:gzip`  gzip, from the JDK.

A stream's encoder lives as long as the stream, and keeps what it sent
before as its window: a frame repeating what an earlier one sent, as a
morph of an island mostly does, is sent as a reference to it. The frame's
events are flushed through the encoder at once, so the client decodes the
frame as it arrives.

The settings are tropical's, measured on streams of frames (see the
logbook), not the app's to tune. Each is a trade of memory for how far back
the window reaches, held for every open stream:

- `:zstd`  level 3, a 256 KiB window: about 0.7 MB a stream.
- `:br`    quality 4, a 128 KiB window: about 0.9 MB a stream.
- `:gzip`  the JDK's default level, and gzip's 32 KiB window: about 0.25 MB
           a stream. A morph of an island larger than the window is
           compressed on its own, without reference to its last.

The native libraries are tropical's: an encoding is loaded when the app
names it, and `ring/handler` throws for one it can't load.
raw docstring

No vars found in this namespace.

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close