In uWebSockets, what are the pros and cons of using a Shared compressor, Dedicated compressor, or no compression?

Viewed 204

Hello friends of Stackoverflow,

I am using the uWebsockets.js library for a realtime app. This library, a performance-based replacement for the original Websockets library, provides a users a few options in terms of memory compression.

In their docs, they specify the option of setting a Shared compressor, Dedicated compressor (with various sizes up to 256kb), and no compression. Here's one of their links to the docs: https://unetworking.github.io/uWebSockets.js/generated/index.html#SHARED_COMPRESSOR

Can someone explain when might a developer prefer using the Shared compressor? Also, in the event someone wants the Dedicated compressor, how would calculate the right balance between speed/CPU? If we run on a 2 CPU system with 4-6 GB RAM, what is ideal if we want to stream 255 byte data packets at 10 FPS?

What happens if someone chooses Dedicate compressor with 3kb (for example), but the data payload exceeds the 3kb buffer? From a technical standpoint, what happens when the data is received?

Of course, no compression simply means the library does not do anything to provide a buffer. But when might someone want to pick this over the other two?

Please kindly explain the advantages and tradeoffs of these options, and ideally an example of a use-case that might be appropriate for each. Thanks in advance!

0 Answers
Related