alphagov/paas-billing

Evaluating formulas on `/billable_events` is slow

Opened this issue · 0 comments

46bit commented

One month of /billable_events for a large organisation evaluates the pricing formulas about 30,000 times. This takes >3 seconds and contributes to that API endpoint being slow. There are several things that could be tried to improve this:

  • Relatively few of the pricing plans actually need to be dynamic. Many of them only need to multiply the duration by a fixed per-second cost;
  • #73 should allow evaluating these formulas only once, when creating billable_event_components in the background.