[Feature Request] Option to compress request payload in a callback
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 24.4k
- Fork
- 2.3k
- Merge medio
- 2g 7h
- PR unite (30g)
- 13
Descrizione
Problem
While the payload of the HTTP response bodies can be compressed in case of transmitting large amounts of data from the server side to the client, this is not possible for the actual HTTP request body of a callback that sends this data to the server side.
Grids are notoriously using huge JSON structures of several megabytes. Transmitting this data via the network can make the application feel sluggish.
Solution
We could have an option to compress the body of a server side callback on the client side. We could introduce two new parameters for the callback:
compress_payload: bool = False: If True, the callback request payload will be compressed using gzip compression before being sent to the server. Defaults to False.
compress_threshold: int = 5_000: The size threshold in bytes above which the payload will be compressed when compress_payload is True. Set to 0 to always compress regardless of size. Defaults to 5,000 bytes (5 kB).
Alternatives
This can partially be simulated by using client-side callbacks that compress and copy the data to a compressed dcc.Store and then rewire the callbacks to use that store and decompress on the server side. However, this bloats the code and application state.
See referenced PR for more details: https://github.com/plotly/dash/pull/3925
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia leggendo la gestione delle richieste di callback e il PR #3925 indicato per comprendere l’approccio proposto. Il lavoro è completato quando i callback possono optare per la compressione gzip, applicano la soglia di dimensione del payload indicata e mantengono il comportamento predefinito senza compressione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- backend-api-design
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100