Replies: 1 comment
-
JetStream file storage does keep file blocks in an in-memory cache, however after a couple of seconds since the last 'cache hit' on a cached block the cache evicts that block from memory. To demonstrate: create a KV bucket, put some messages in it, then measure the latency of a 'get' operation on one of the keys. The first time you do the get it will take a couple of ms (needs to read the file block in the cache), but then if you do a get again on the same key (technically on any other key stored in the same block file) within a couple of seconds then you should get much lower latency for that get (to give an order of magnitude, when going over the loopback interface a get that hits the cache should be similar latency than if the storage is memory rather than file, a get's latency is in the 40 to 50 micro-second range on a Mac Studio). |
Beta Was this translation helpful? Give feedback.
-
I'm wondering if the jetstream FileStorage Storage does also cache values in memory.
e.g. when I publish few values to the KV store I expect them to be persistent. But when I query them, does JetStream keeps a copy in Memory to allow faster access? Or when a single value is queried many times but rarely written, caching could boot performance a lot.
If that's not the case, I would use a MemoryStorage, but then an option to persist this strorrage (e.g. regularly and on graceful shutdown) could help to keep the cache warm after a reboot.
If not is something like that planned (I assume some configuration about such a feature would be needed).
Would be interested in you opinions and plans.
Beta Was this translation helpful? Give feedback.
All reactions