Impl. size-dependent request body compression #4283
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem 1
When loading studies with large number of samples there are a large number of endpoints that try to send extended lists of sample identifiers to the backend. In uncompressed for this can take minutes for ~100k samples. This bottlenet can be removed by compressing the request body before sending. At present this is implemented for specific endpoints. I found out that certain (new?) endpoints are not listed for compression and therefore lock the frontend in an inresponsive state. Therefore, the mechanism of selecting specific endpoints for compression does not effectively solve the problem of large request bodies when the configuration only partially covers problematic endpoints.
Problem 2
The current request body compression is only applied to endpoints of the public API. Certain endpoints of the internal API are very slow.
Solution
I propose to evaluate body of every POST request for size and compress the body when the number of characters in the JSON string exceeds a certain threshold (now arbitrarily set at
500
characters). The compression mechanism covers both public and internal API's.