Skip to content
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

ChainMonitor serialization time is too long #3557

Closed
eauxxs opened this issue Jan 23, 2025 · 1 comment
Closed

ChainMonitor serialization time is too long #3557

eauxxs opened this issue Jan 23, 2025 · 1 comment

Comments

@eauxxs
Copy link

eauxxs commented Jan 23, 2025

The reason is that I found in the ldk-node test that it takes about 300 seconds to send and receive payment for 20 rounds, which I think is too long. I found that there is a waiting time of about 2 seconds for each message sent. I found that the persistence of chainmoniter takes an average of 1.5 seconds each time, and the length after serialization (len(vec)) is about 54000. The relevant persistence code is often executed, so is there any possibility of optimization here?

@tnull
Copy link
Contributor

tnull commented Jan 23, 2025

So Lightning in general is IO-bound as we need to make sure all the updates to ChanelMonitor are persisted before being able to move on with certain operations.

I found that the persistence of chainmoniter takes an average of 1.5 seconds each time

This is indeed really long. I haven't seen similar numbers yet, so I'd love to learn more about your scenario and how many channels you're operating (note that it's the ChannelMonitors, not ChainMonitor that is persisted). Feel free to reach out on LDK Discord or open a new issue on the LDK Node repository to discuss/debug these numbers in particular.

That said:

so is there any possibility of optimization here?

Yes there are possibilities. Here in LDK/rust-lightning we're working towards improving on how often we persist monitors when it's not not strictly required. Moreover, LDK introduced the MonitorUpdatingPersister which allows to only persist delta's instead of whole monitors every time we make an update. While planned, we simply haven't gotten around to make use of it in LDK Node yet. I now opened an issue for over there though: lightningdevkit/ldk-node#441

Closing this issue as the question mainly relates to LDK Node.

@tnull tnull closed this as completed Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants