NATS Object Store or Key Value Store vs Redis Cache
Asked Answered
H

1

13

We are currently using Redis behind NATS to do caching which is a standard practice. However, I have come across this idea that we can take advantage of the Object Store or Key Value features in NATS to implement caching natively. However, I know that:

  1. Key Value is developed for stable message streaming
  2. Object Store is developed for chunking large data so that we don't need to change the max 1 Mg message configuration

On the other side, all these have TTL for data which is favorable.

My question is that, is it technically correct to replace the current Redis cache which we have behind NATS with the JetStream?

Some possible scenarios we are handling:

  1. Reading a large amount of data and applying pagination on that which is currently done in Redis, but I am thinking about using the object store for that.
  2. Basic caching, reading once from the database and cache the read value for 30 seconds
Henghold answered 27/2, 2023 at 3:5 Comment(4)
Curious if you ever went ahead with this. We don't implement Redis but are thinking about using the KV store along with notifications to implement caching. Basically cache locally and in the KV store and watch for updates to refresh the local caches.Trochelminth
@AlexGad: I have already move on with this and so far everything is so good. The only disadvantage is that, Redis comes with a client that you can use to browse keys or manually delete them. NATS doesn't have anything like that, at least as far as I know.Henghold
The nats-cli github.com/nats-io/natscli can do thisRhonarhonchus
@ArnoldZahrneinder github.com/andrejsoucek/nats-cui still WIP but usable :-)Cuellar
T
-2

I have the same idea: use nats(jetstream) as the message broker and the some basic data store.

Timetable answered 5/1 at 2:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.