NATS Jetstream Internals #3955
-
Hi all, thx for building nats, it’s a great piece of software. I would like to learn a bit more about the internals of nats, especially the design of the Jetstream. What I understood so far based on the docs: There are multiple raft groups that are responsible for replicating/storing certain aspects of the Jetstream like streams, consumer and meta-data. Can you share some more details about the Jetstream design? Especially, how data is stored? Is the data of raft groups stored in a partitioned manner? I am basically familiar with raft based databased systems. Typically, there are tables, tables are split into tablets, tables are replicated based on raft. How does it work in nats Jetstream? According to the documentation the recommend number of Jetstream enabled servers is 3/5. Does it mean this is recommend maximum number of Jetstream enabled servers? If so, I am not sure how this affects scalability, because this would mean, that all related Jetstream data hast to be stored on the Jetstream servers. Regards |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Regarding the limits - 3 or 5 are recommended levels per stream (5 is the enforced max). That means the stream will inhabit 5 servers but it could be in a much larger cluster over all. With streams spread out over more but never exceeding the limit per stream. Otherwise as you say each stream has a raft group and so does most types of consumer (ephemeral are not raft based). The meta cluster handles placement of streams and some other things like stats and various API calls and all servers (even more than 5) belong to it. |
Beta Was this translation helpful? Give feedback.
-
@ripienaar |
Beta Was this translation helpful? Give feedback.
@ripienaar
How are writes (publish) and reads (subscription) are handled in terms of raft? I guess publish calls are always coordinated via the raft leader and reads are served by the followers as well?