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

Batch remove offers in OffersProcessor #3246

Closed
bartekn opened this issue Nov 23, 2020 · 2 comments · Fixed by #3249
Closed

Batch remove offers in OffersProcessor #3246

bartekn opened this issue Nov 23, 2020 · 2 comments · Fixed by #3249
Assignees
Labels
horizon performance issues aimed at improving performance

Comments

@bartekn
Copy link
Contributor

bartekn commented Nov 23, 2020

What version are you using?

1.11.1

What did you do?

Processor durations stats added in #3224 revealed that OffersProcessor (green line) is much slower than other processors:

Screenshot 2020-11-23 at 17 55 38

Comparing this to Ledger Entry Change chart we can see that there are a lot of offer removals in ledgers:

Screenshot 2020-11-23 at 17 56 34

It looks like batching offer removals could largely improve the speed of ingestion:

case change.Pre != nil && change.Post == nil:
// Removed
action = "removing"
offer := change.Pre.Data.MustOffer()
offerID = offer.OfferId
rowsAffected, err = p.offersQ.RemoveOffer(int64(offer.OfferId), p.sequence)
. Because batch removals can be useful for other processors (and services) we should create a new struct in support/db similar to BatchInsertBuilder. Actually we don't DELETE offers but we update deleted flag. We should change the query to use IN instead of =.

@bartekn bartekn added horizon performance issues aimed at improving performance labels Nov 23, 2020
@bartekn bartekn changed the title Add BatchDeleteBuilder for batch deletions Batch remove offers in OffersProcessor Nov 23, 2020
@bartekn bartekn self-assigned this Nov 24, 2020
@bartekn
Copy link
Contributor Author

bartekn commented Nov 26, 2020

2x improvement!

Screenshot 2020-11-26 at 11 03 35

@ire-and-curses
Copy link
Member

Wow, super cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
horizon performance issues aimed at improving performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants