-
Notifications
You must be signed in to change notification settings - Fork 376
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
Run async event processing in parallel #2491
Comments
What would it take to do this? I'm looking at the for (event, action_opt) in pending_events {
$event_to_handle = event;
$handle_event;
if let Some(action) = action_opt {
post_event_actions.push(action);
}
} Looks like we'd need to change the macro so it somehow works for both async / blocking, and slap a As a temporary workaround, would it be okay to spawn off all event processing into tasks (using the blocking |
Note we already started doing this for
Since we added fallible event handling in #2995 we expect the event handler to actually return a Remind me, what type of events / what in particular makes this a bottleneck for you? |
Sadly, no. Right now PaymentSent events block monitor persistence to ensure that you've had a chance to see+persist the payment preimage (proof of payment) before it is irrevocably deleted in the monitor. |
Heya! Just saw this.
Event handling in general is pretty hot for our LSP, which connects to possibly thousands of user nodes.
I took a look at the updated code! Very helpful improvement. I think the replay behavior should be independent between events. For example, if our LSP gets events for users A, B, C in the queue, failure to handle the event for user A shouldn't block the handling of the event for users B and C. FWIW, earlier discussions about whether events needed to be processed in order didn't turn up any examples. Full concurrency In the long term we'd love to have some interface where LDK feeds us events from the queue even before the channel manager persists them, where the contract is "do your best to durably persist, then handle these events", which would allow for concurrency between batches of events in addition to concurrency within batches of events. Or some other construction which allows for full concurrency between batches. But if we only have within-batch concurrency in the near term, that's a major improvement over what exists today. |
Mhh, seems to me that would be better/easier solved by introducing a 'proper' HTLC interception interface (cf. #2855), rather parallelizing event handling?
The main expected reason why event handling would fail are persistence failures, in particular for remote persistence. It therefore makes sense to assume that if one fails, we can't make progress on any and rather need to exit and eventually (currently right-away) retry without losing any events. |
The HTLC intercept is for sure the biggest issue, so we're moving that into a separate persisted queue for later handling. But several other events ( After removing our previously crash-unsafe event handling (spawning a task to handle each event and immediately returning), we're back to serially handling each event one-after-the-other. Since we're persisting events serially, we'll take Maybe a short-term improvement would be passing the whole Though might be a little tricky to integrate with the fallible handling : D |
I think we can Just Do This (tm) with some additional documentation on events and the handlers. CC https://github.com/orgs/lightningdevkit/discussions/2381
The text was updated successfully, but these errors were encountered: