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

Add pagination support for clear packets #2077

Closed
1 task
Tracked by #1816
adizere opened this issue Apr 7, 2022 · 3 comments
Closed
1 task
Tracked by #1816

Add pagination support for clear packets #2077

adizere opened this issue Apr 7, 2022 · 3 comments
Labels
A: breaking Admin: breaking change that may impact operators O: performance Objective: cause to improve performance O: usability Objective: cause to improve the user experience (UX) and ease using the product
Milestone

Comments

@adizere
Copy link
Member

adizere commented Apr 7, 2022

Problem

In production, Hermes often encounters the problem of needing to clear many (hundreds) of packets on a given path. This can take a very long time, a problem compounded due to full nodes being slow at times. If a node is slow and Hermes takes a long time (on the order of minutes) to build a transactions for relaying some packets, that transaction might prove to be invalid or outdated by the Hermes finally submits it, making the whole process very painstaking.

The problem is that Hermes does bulk actions while trying to clear the packets on a path. This can be seen in the following spots that are on the critical path of clear packets CLI, for example:

Acceptance criteria

Discussion

Hermes CLI for packet clearing should provide support for splitting the workload in multiple, smaller batches, to make this command more tractable. This can be done, for instance, with any of the following suggestions:

A. By adding a flag clear packets ... --limit X to specify that Hermes should limit itself to fetching only X amount of packets/acks (instead of all pages). The limit option should probably be mandatory.

B. Alternatively, we could handle splitting into smaller batches of X messages automatically within the implementation of clear packets and have a simpler interface.

The advantage of A. is that the command is a lot more interactive and will finish faster. The problem is that the operators will not know if there will still be packets left to relay, so they will need to repeatedly invoke clear packets --limit X until this method returns an empty result (signalling there was nothing to clear).

The advantage of B. is that this command is smarter and simpler. The disadvantage is that will take longer to finish. On a high-activity path with constant activity, depending on the implementation and how we split-up the batches, I can even imagine that this method will constantly run for as long as there are packets being created, which is a problem (the CLI should return, instead of grabbing & relaying every new packet).

Other solutions might exist. We should evaluate the pros and cons through the lenses of operator user experience and simplicity.

Tasks

  • add integration tests to assert the correctness of new behavior
@adizere adizere added this to the v0.14.0 milestone Apr 7, 2022
@adizere adizere added O: usability Objective: cause to improve the user experience (UX) and ease using the product O: performance Objective: cause to improve performance A: breaking Admin: breaking change that may impact operators P-high labels Apr 7, 2022
@romac
Copy link
Member

romac commented Apr 7, 2022

Ideally the command would use pagination and display its progress as it clears the packets, perhaps with a nice TUI progress bar?

On a high-activity path with constant activity, depending on the implementation and how we split-up the batches, I can even imagine that this method will constantly run for as long as there are packets being created

That's indeed an issue, not clear how to avoid that. Perhaps by not trying to clear packets at a higher height than the one the chain was at when the command was started? ie. the command would clear packets from oldest to newest and stop once it sees a packet at a height higher than the starting height

@romac
Copy link
Member

romac commented Apr 8, 2022

Alternatively, query packet pending could return all the information needed to clear the packets it gathered, and this info could be piped into clear packets via stdin so that the command would only clear those packets. Seems a bit more involved and not a Cli pattern we've really explored so far.

@adizere adizere removed the P-medium label Apr 12, 2022
@adizere
Copy link
Member Author

adizere commented Apr 12, 2022

Closing in favor of #2087

@adizere adizere closed this as completed Apr 12, 2022
Repository owner moved this from Backlog to Closed in IBC-rs: the road to v1 Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: breaking Admin: breaking change that may impact operators O: performance Objective: cause to improve performance O: usability Objective: cause to improve the user experience (UX) and ease using the product
Projects
No open projects
Status: Closed
Development

No branches or pull requests

2 participants