Scale and contention
How do you calculate the invoice amount and required finalisation rate?
Test the requirements at an explicitly fictional scale: 100,000 contracts, each with 10 usage events per day. Consider average load, peaks and concurrency separately.
Starting point Separate positive usage from correction records.
Assumptions for the example case
Original fictional example design: one monthly contract in EUR, positive integer usage units, a fixed tariff version per period, one invoice and one payment order, and separate correction records. Figures and quality targets are illustrative test assumptions. Tax law, multiple currencies, prorated tariff changes and debt collection are outside the scope.
Throughput and the contended resource
Usage stream and month-end finalisation
11.574 events/s load the ingestion path; 27.78 invoices/s determine the finalisation window.
Reproducible test profile calculations
- 01
Average load
100,000 contracts with 10 usage events/day1,000,000 ÷ 86,400 s = 11.574 events/s
For the designThe rate describes the assumed total volume; response time still requires measurement.
- 02
Peak test
Month end 100,000 invoices in 3,600 s = 27.78 invoices/s1000 cents + 100 units × 2 cents/unit = 1200 cents
For the designThe additional quantity calculation defines a separate check of resource or retention needs.
Test concurrency separately
- Test oracle
- Period finalisation and N-161 compete. Ingestion wins: R-161 totals 1,200 cents. Finalisation wins: R-161 totals 1,000 cents, and N-161 produces a separate 200-cent correction record after review. In either order, the 100 units are billed only once overall.
Calculate the finalisation rate
Use 27.78 invoices/s as a separate test profile.
Create 100,000 invoices in one hour.
Daily usage and month-end finalisation impose different loads.
- Alternative considered
- Measuring only average usage misses the finalisation surge.
- Trade-off
- Period-finalisation jobs need spare capacity.
- Reassess
- The number of contracts or the finalisation window changes.
Terms in this step
- Calculate the finalisation rate
- Daily usage and month-end finalisation impose different loads.
Try it yourself
Calculate R-161 and the finalisation rate for 100,000 invoices in one hour.
A hint for your attempt
Use the specific entities and conditions from this step. The two solution parts distinguish the decision from its evidenced outcome.
Compare with a possible solution
- First part of the solution
- 1,000 cents plus 100 times two cents is 1,200 cents.
- Second part of the solution
- 100,000 divided by 3,600 seconds gives 27.78 invoices/s. Month-end finalisation needs a different profile from daily usage ingestion.
Apply to your project
Which corresponding assumption in your project would you check first when the contract count or finalisation window changes?