-
Notifications
You must be signed in to change notification settings - Fork 239
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
PoH - Reserve Space #1227
Comments
oh, i think this can be solved more elegantly just with crossbeam-rs/crossbeam#959 (cc @behzadnouri; he also came up with the similar idea: crossbeam-rs/crossbeam#861) the idea is that we can guarantee block insertion just just from the simple fact of succeeding in (one-sided) sending to the poh thread. so, no need to wait replies from the poh thread. that said, that upstream pr is kind of stale. we can patch the crossbeam-channel or just wrap the crossbeam channel with mutex (ugh). |
Exactly, the whole point of this issue is to have this guarantee. I'm not sure I understand the suggestion w/ crossbeam though. At least currently we use the same channel to send to poh thread throughout the lifetime; do you mean use the disconnect approach, and need to swap out channels for every new slot? |
exactly. so that senders can be notified about end of slots. |
Yeah that seems like an approach that'd work. |
Well, I think we need some bench to preclude that. Now that Mutex is futex-based, it's not so different from having another crossbeam channel. I'm not saying this is a permanent solution, though. Also, come to think of it, RwLock could be used to mitigate contentions among the external (i.e. tx-sending) threads, because it's guaranteed that there's the single receiver.
Sadly, none. Seems the maintainer is too busy... I'm replying as fast as i can. At this moment, i think patching or forking makes sense. So, ultimately, which solution (reserve, Mutex, or disconnect) to be taken could largely depends on the enginener's preference, i guess. Fortunately, this isn't consensus change and the change is quite localized. so, relatively easy to switch the solutions. |
My main contention with mutex was blocking of execution threads by other execution threads. I guess I'm also not quite sure how this approach would work. In crossbeam the |
recording thread will only write-lock at the end of slots. But as said below, use of RwLock is awkward.
ohh, true.
this is true as well
Yeah, that works. but it's odd even more. Instead, I think we need |
I created such a wrapper: https://gist.github.com/ryoqun/80adbd49c1658812b47fcf35bacb058f |
further update: I created revamped pr upstream: crossbeam-rs/crossbeam#1114 |
Reviewing this, I think we still need/want some reserve method instead. We currently return the transaction index w/ the result of recording which the worker threads use for something(?). I'm imaginging we could do something like having a |
I think the slowness comes from the fact that when the poh thread sends results back, the banking threads are always sleeping so it needs to syscall to wake them up. Ban syscalls. |
Yeah. those threads are always sleeping. |
This sounds like a fixed capacity ringbuffer with head and tail that can advance independently without contention |
yeah ideally we could have some sort of ring-buffer, large enough we expect to never fail to insert. |
Problem
Assuming cluster average hash-rate of 10M hashes/sec. This means the interval of checking the channel is around 6.4us.
Proposed Solution
Need to compare alternate implementations:
The text was updated successfully, but these errors were encountered: