Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Add zstd support #11742

Open
zamazan4ik opened this issue Jan 21, 2023 · 4 comments
Open

[NEW] Add zstd support #11742

zamazan4ik opened this issue Jan 21, 2023 · 4 comments
Labels
state:to-be-closed requesting the core team to close the issue

Comments

@zamazan4ik
Copy link

zamazan4ik commented Jan 21, 2023

The problem/use-case that the feature addresses

Use a cheap algorithm for built-in compression in Redis to reduce memory usage.

Description of the feature

Add built-in zstd support to Redis. If having built-in compression is against Redis philosophy, could you please at least mention zstd algorithm as a recommended way to implement compression here: https://docs.redis.com/latest/ri/memory-optimizations/ ?

If it's already supported - could you document it, please?

Alternatives you've considered

Try to use external modules like https://github.com/chadnickbok/redis-zstd-module but it's a riskier way since 3rd party modules have worse support, could be outdated, etc.

@oranagra
Copy link
Member

for many use cases, specifically for simple strings (SET and GET, HSET and HGET commands), it makes much more sense to compress these at the client side and benefit from reduced network load. i.e. unless redis needs to process that data like doing GETRANGE or LCS.

please explain what's your use case for that and why this is not preferred.
p.s. i don't see any reason to document what we don't support or suggest a trivial thing like client side compression.

@zamazan4ik
Copy link
Author

please explain what's your use case for that and why this is not preferred.

Sure! Client-side compression requires changes on the client-side. Server-side compression could be enabled transparently to the clients.

p.s. i don't see any reason to document what we don't support or suggest a trivial thing like client side compression.

Maybe but why in this case you already have the documentation regarding the compression in Redis documentation? :) Here is a quote from https://docs.redis.com/latest/ri/memory-optimizations/#compress-values

Compress values
Redis and clients are typically IO bound and the IO costs are typically at least 2 orders of magnitude in respect to the rest of the request/reply sequence. Redis by default does not compress any value that is stored in it, hence it becomes important to compress your data before storing in Redis. This helps in reducing the payload which in return gives you higher throughput, lower latency and higher savings in your cost.

How to compress strings
There are several compression algorithms to choose from, each with it’s own tradeoffs.

Snappy aims for high speed and reasonable compression.
LZO compresses fast and decompresses faster.
Others such as Gzip are more widely available.
GZIP compression uses more CPU resources than Snappy or LZO, but provides a higher compression ratio. GZip is often a good choice for cold data, which is accessed infrequently. Snappy or LZO are a better choice for hot data, which is accessed frequently.

Compressing strings requires code changes. Some libraries can transparently compress objects, you would only need to configure your library. In other cases, you might have to compress the data manually.

@oranagra
Copy link
Member

ok, you're right, if we mention one, we might as well mention the other, but then i would wonder where does it end. maybe the right thing is to drop the mention of Snappy and put some general text.
@itamarhaber please advise (maybe you can provide some historical reasoning about compression, and also suggest what to do with the docs).

@itamarhaber
Copy link
Member

Client-side compression is a valid practice. Redis itself has no special support for it, and therefore this information isn't included in the project's docs. The Enterprise docs apparently include some information about this pattern - @zamazan4ik, please suggest this improvement to https://github.com/RedisLabs/redislabs-docs/edit/master/content/ri/memory-optimizations.md

@oranagra oranagra added the state:to-be-closed requesting the core team to close the issue label Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:to-be-closed requesting the core team to close the issue
Projects
None yet
Development

No branches or pull requests

3 participants