Add options to compress callback request payload - #3925
Conversation
|
Doesn't dash already support this via the Maybe adding support for fast api's compression directly in dash could be helpful too: https://fastapi.tiangolo.com/advanced/middleware/#gzipmiddleware And ideally you don't really want dash running compression on the main thread in most cases. Having the server do it instead is generally better/faster/more flexible, such as nginx https://docs.nginx.com/nginx/admin-guide/web-server/compression/ |
[…]
This was also my first thought when I looked into this! Unfortunately, all these standard compression mechanism will only work for the HTTP response from the server to the client downloading the data. This PR would address the other direction when uploading the data which is not covered by the standard means. I enhanced the description to make this a little more clear. |
|



This is a starting point implementation that implements an option to compress the payload of a callback's request (see #3924).
This would be useful when transmitting large amounts of data from the client-side to the server-side (server to client is already covered by standard HTTP compression via Content-Encoding).
Advantage of this solution is that it does not depend on compressing individual properties and can be used without compromising client-side callbacks to be able to access properties.
Downside is that a new dependency has to be introduced to actually compress the payload in the browser (I opted for https://github.com/101arrowz/fflate).
I would expect this change to be able to really speed-up application performance for use-cases where loads of data are transmitted and would love to get some feedback on this. I did some experiments and observed roundtrip response time improvements up to 10x. Some numbers showing the average speed-up ratio of the roundtrip response time depending on the connection and the payload size.
Compression almost never hurts the roundtrip response times which is why I would go for a default
compress_thresholdof around 5 KB - 50 KB (but keepcompress_payload=Falseper default).Naming of the parameters could be adjusted if we want to emphasise that they only apply to the request part of the callback and not the response.
Contributor Checklist
compress_payloadandcompress_thresholdto callbacksoptionals
CHANGELOG.md