Introduce Brotli compression for keyserver -> client socket messages
Summary:
This addresses ENG-5018, which is one of the follow-ups to ENG-5007.
Scoping this just to staff members for now. If this goes well, we can try the same thing for client -> keyserver socket messages and for HTTP REST endpoints as well.
Depends on D9293
Test Plan:
I tested sending a UTF-8 message (emoji with skin tone) from web to native and from native to web. I then forced a socket reconnection for the sender, and confirmed that the message didn't change once the socket was established.
I also tested adding somebody to the Comm org in my local environment. Note that I have only 275 chats inside the Comm org in my local environment, compared to 971 in production.
compressing message with size 7249341 to size 49747 took 1305ms compressing message with size 7259629 to size 52163 took 1389ms compressing message with size 6950442 to size 49431 took 1225ms compressing message with size 7249345 to size 49683 took 1329ms
The compression time was approximately the same whether the sync or async Brotli compression function was used.
While this will increase CPU usage, the massive benefits of shrinking a 6.91 MiB payload to 48.58 KiB definitely outweigh the costs. I also made sure to only utilize the compression when the payload is at least 4 KiB.
Reviewers: atul, michal, kamil, bartek
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D9294