System Design Atlas

Digital lending with limited licences

08 / 10Worked example

Bottlenecks and trade-offs

Stale search results and lost licences are distinct. Which conditions guide diagnosis?

The index and service can be slow for different reasons.

Starting point Reconcile the same command.

Assumptions for the example case

A fictional library with one licensed copy and reading devices that verify entitlements online. Every new read checks the current entitlement; offline use is outside the scope. All quantities, thresholds and operational targets in this design are illustrative assumptions.

Search staleness or licensing wait time

Search staleness or licensing outcome

Search result shows availabilityAllocation fails
Licence pending for 30 sService outcome unknown
Index ageGeneration + Time
Rebuild the index projectionIndexing worker
A-52 statusExact reference
Review listPlatform operations
Treffer wirkt frei → IndexalterMeasure projection freshness
Indexalter → Index neu projizierenIf stale
Lizenz seit 30 s offen → A-52-StatusService reconciliation
A-52-Status → KlärlisteIf still unknown

Each path connects a symptom, measurement and action with assigned responsibility.

Investigate stale results and unknown service outcomes separately.

From symptom to targeted action

SignalValidationAction and limit
Loan duration14 days ×24 h ×3,600 sStore expiry as an unambiguous UTC instant.
Search load50,000 searches / 1,000 allocationsThe search index may lag; allocating the last licence requires a transaction.

Loan duration

Validation
14 days ×24 h ×3,600 s
Action and limit
Store expiry as an unambiguous UTC instant.

Search load

Validation
50,000 searches / 1,000 allocations
Action and limit
The search index may lag; allocating the last licence requires a transaction.

A stale search result does not lose a licence.

A stale search result does not lose a licence.

Measure search staleness and pending command duration separately.

The index and service can be slow for different reasons.

Update the projection and keep validating allocations. Reconcile the existing reference and keep the copy allocated.

Alternative considered
More index capacity cannot reconcile a licensing command.
Trade-off
Two diagnostic pathways are needed.
Reassess
Measurements determine the next improvement.

Try it yourself

Choose an action for incorrect availability and for pending issuance.

A hint for your attempt

The index and service can be slow for different reasons.

Compare with a possible solution
Index
Update the projection and keep validating allocations.
Service
Reconcile the existing reference and keep the copy allocated.

Apply to your project

What is the equivalent of distinguishing stale search results from lost licences in your project?

Step 9: recovery starts by reconciling entitlements. Which conditions permit resumption?