-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
nsqd: per-topic WAL #625
base: master
Are you sure you want to change the base?
nsqd: per-topic WAL #625
Conversation
Updated description, let me know if any of this sounds insane @jehiah. |
depth, The current plan is for each topic to maintain a I don't really know what to do about This is also the mechanism we can use to determine what the retention window for a topic should be. By scanning each channel's |
any thoughts on how the performance of this compares for single channel, 100% of msg going into diskqueue vs into WAL, and 100% of reads going out of diskqueue vs WAL ? (i presume once multiple channels come into play, the shared WAL vs individual diskqueues makes the WAL significicantly better) also: will there be (optional) sync-ack semantics? so that the producer only gets an ack when the data has been synced to disk. needless to say this comes with a performance tradeoff but can be worth it if message size is big enough. |
@Dieterbe working on correctness right now 😁. Performance should be better. |
@mreiferson is ack-on-sync something you think should make it into nsqd as well? |
@Dieterbe that already is the case in both the current production implementation (IF the message overflowed to disk) and this PR. If it were not the case there would be no back-pressure! |
@mreiferson I doesn't look like it.. or there is a misunderstanding. |
Sorry, I misunderstood what you meant by "sync" - no, there is no mechanism to deliver fsync acks to producers. The complexity doesn't feel like something that would be worth it. The edge cases where you would lose messages, although they certainly exist, are probably better handled via replication. You could also run with |
NOTE: there is still back-pressure from the periodic fsync because |
Nice work! I'll dig into it a bit more later this week |
@mreiferson: does this mean that
|
|
|
(2) It's already required to be able to seek to a certain index |
edbb15e
to
ffa6b45
Compare
2898aec
to
dc5221b
Compare
This introduces a write-ahead log for
nsqd
topics using https://github.com/mreiferson/wal. This is the first part of #510.At a high level, the WAL is a filesystem backed FIFO queue with monotonically increasing IDs, optional periodic flushing semantics (off by default), and the ability to open a "cursor" at any index within its retention window. Many cursors can be open simultaneously at different indices.
Each topic has its own WAL and each channel has its own cursor into it. The filesystem replaces the per-topic goroutine
messagePump()
that previously copied messages to channels. Instead, we use Go's low-levelsync.Condition
to "wake up" any open cursors so they can advance when events are appended.There are quite a few remaining items to figure out here, namely:
BackendDepth
?DPUB
attempts
accounting