-
Notifications
You must be signed in to change notification settings - Fork 64
Compression
DotPulsar support compression from version 0.11.0 (released 2021-02-21).
All we have to do is install the needed NuGet packages listed below and DotPulsar will automatically detect them.
- LZ4 - by adding the NuGet package K4os.Compression.LZ4
- SNAPPY - by adding the NuGet package IronSnappy
- ZLIB - by adding the NuGet package DotNetZip
- ZSTD - by adding the NuGet package ZstdNet or ZstdSharp.Port
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...
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.
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.
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.
- Selecting only what you want and trust
- To not have your runtime bloated with unnecessary binaries
- To avoid versioning conflicts