Replies: 4 comments 2 replies
-
|
Can you describe the state that is being read, the one you want locality for? Is it a file read? A Key Value pair? |
Beta Was this translation helpful? Give feedback.
-
|
Maybe consider using JetStream KV or Object store and have realtime mirrors on all the nodes. These can be configured to expire after a certain amount of time or when new entries are added. |
Beta Was this translation helpful? Give feedback.
-
|
@plaisted, I have a very similar use case to yours (reading large files and want to try routing within an AZ if possible to reduce costs). Did you settle on a NATS pattern that facilitated this / that you were happy with? |
Beta Was this translation helpful? Give feedback.
-
|
One possible option that may work for you, assuming the data is really just caching data and therefore initially created by the node that receives the first request, and assuming you have something in the subject that you can use to identify related requests: partitioned consumers groups https://github.com/synadia-io/orbit.go/tree/main/pcgroups will deterministically distribute the messages in a stream between a set of 'members' (consumers). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a data processing application that runs in a kubernetes cluster that uses NATS Jetstream work queues and pull subscriptions. As it stands now the consumer that gets a message is relatively random (combination of round robin from NATS and timing of an open worker). I'm looking for a way to promote data locality, in this case when a message is published it would prefer to be read by a worker on the same node (so that a local cache would be used to read the results of the last step) but if there are no local workers available it could be pulled by a worker on another node.
I could publish to node specific topics (eg. work.{node name}) and have the stream read all the topics for the work queue but don't see a way to get it routed locally if possible without writing some sort of custom message broker to route the work around. Is there some existing functionality that could support a use case like this that I've missed?
Beta Was this translation helpful? Give feedback.
All reactions