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

Perf issues around tracking ids when populate large invoice (or all invoices for an account) #1952

Open
sbrossie opened this issue Jan 19, 2024 · 1 comment

Comments

@sbrossie
Copy link
Member

The code inside invoice will populate the shell invoice with its items, payments, tags and tracking ids. However there are many code paths where such of these elements are not useful.

In particular, we should look at whether for internal use (e.g. invoice run), we could bypass tracking ids.

A more elaborate approach would be to make such loading lazy and only call it if such data is being used.

@sbrossie sbrossie changed the title Performance issues around tracking ids when populate large invoice (or all invoices for an account) Perf issues around tracking ids when populate large invoice (or all invoices for an account) Jan 19, 2024
@sbrossie
Copy link
Member Author

sbrossie commented Jun 4, 2024

Anytime we rehydrate an invoice from disk, we 'populate' all the elements of the invoice, including the trackingids.

I don't believe such trackingIds are used anywhere internally in the code, except for when this needs to be returned to the client; in which case this is first set in the InvoiceModelDao#trackingIds, and then in the DefaultInvoice#trackingIds.

Since we don't have an api flag to bypass returning such trackingIds, the first goal would be to not populate those for any internal KB invoice - i.e we only populate when fetching an Invoice from api.

In a subsequent Kill Bill version (e.g. 0.26.x) we could consider adding a flag to decide whether to return or not such items based on client needs.

To be more concrete, fetching trackingIds could probably be disabled in the following use cases:

  • create refund as shown here
  • delete CBD as shown here
  • compute invoice item adjustment as shown here
  • set parent invoice as shown here and here
  • cba complexity as shown here

In addition to those, we should check for all the get paths that are used for apis, whether we also use those internally and possibly introduce a flag to discriminate between internal and external (invoice api) use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants