Skip to content

Compression

Daniel Blankensteiner edited this page Jun 14, 2022 · 2 revisions

Compression

DotPulsar support compression from version 0.11.0 (released 2021-02-21).

Enabling compression

All we have to do is install the needed NuGet packages listed below and DotPulsar will automatically detect them.

Why doesn't DotPulsar just include them by default?

Choosing dependencies is never easy, especially when the project will be a dependency for others like DotPulsar is. There are often a lot of NuGet packages that do the same thing, but which one is the best? So we start investigating:

  • Is it maintained? When was the last release? When was the last commit? How many contributors are there?
  • How many are using/downloading it? Are any of the users major open source projects or known companies?
  • Is it performant? Does it support async? Does it support ReadOnly-Span/Memory/Sequence?
  • Is it stable? Is it resilient?
  • Is it well documented? Is the documentation up-to-date?
  • Can we get support? Is there a commercial offering or an active community?
  • Is the license acceptable?
  • Is it written in .NET or just a wrapper over some native code? If the latter, will it run on the platforms I'm using?
  • Does it have the right target frameworks?
  • What dependencies will it bring in? (For each dependency we again ask the same questions)

The above are some of the questions we start asking ourselves and eventually we make a choice but...

What if we don't need compression?

Maybe we don't need compression but now DotPulsar will bring in all these compression packages and their dependencies. Not nice! Therefore, these dependencies are optional. Install them only if we need them.

What if we are using another version of the dependency?

Maybe we are already using e.g. IronSnappy, but a different version and now this is causing problems for us? With optional dependencies, it's possible to support multiple versions of the same library, even though it was breaking changes.

What if we are already using another compression package?

Maybe we are using e.g. Snappier instead of IronSnappy and now we have both in our runtime. Since optional dependencies are "free" to add, we can simply start adding support for more options, so that we can choose between Snappier and IronSnappy.

We respect the freedom to choose your dependencies

  • Selecting only what you want and trust
  • To not have your runtime bloated with unnecessary binaries
  • To avoid versioning conflicts