Skip to content

Option to compress data in dcc.Store #3452

@datenzauberai

Description

@datenzauberai

Is your feature request related to a problem? Please describe.
As also noted in #2123 the stateless architecture can result in a lot of data that is being stored in the client. We find that network transfer of these states alone can be the culprit for sluggish applications when a request has to transmit 1 MB of state data... A redesign that avoids this data transfer is not always easily possible.

Describe the solution you'd like
It would be great, if the dcc.Store component had an option to automatically store the data compressed in the browser. The cost of compressing and decompressing on the server side is normally really low and the reduction in size is often huge. A limitation might be that client-side JavaScript would not easily be able to manipulate the data without decompressing it.

Describe alternatives you've considered

  1. HTTP compression, but this is only addresses sending data from the server to the browser. Most browsers won't compress request bodies.
  2. Manual compression/decompression, which works quite fine. Output compressed_data = zlib.compress(orjson.dumps(data, option=orjson.OPT_NON_STR_KEYS)).decode("latin1") to the store and decompress the input data = orjson.loads(zlib.decompress(compressed_data.encode("latin1"))).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogfeaturesomething new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions