System Design Atlas

Rental and sharing system

02 / 10Worked example

Requirements

What commitment must apply to competing reservations?

From the system boundary, we derive desired functions, immutable rules and measurable quality goals. The API (programming interface) accepts requests and provides their status.

Starting point From step 1: The rental application is responsible for vehicle A, the period 9-12 o'clock and the rental status; external services provide tested results.

Assumptions for the example case

Example design: an operator, specifically assigned vehicles, planned periods and a region. Figures are illustrative design assumptions, not company data.

A reservation in three levels

The same reservation on three levels

Function

What the person can trigger and see.

Reserve vehicle ARequest 9 am–12 noon and receive the temporary hold.
Reading statusR-17 and expiration time for the further step.

Invariant

Which rule applies to each change of state.

At most one holdTwo requests may be received; no more than one occupancy shall take effect.
K-17 identifies the same commandA repetition does not create a second reservation.

Quality objective

How the performance is later measurably checked.

Hold: p95 ≤ 500 ms95 out of 100 local holds remain under 500 milliseconds.
Search: p95 ≤ 1 sThe display may lag; the reservation performs the authoritative check.
Question 1 · K-17Vehicle A · 9 am–12 noon
Request 2 · Other ordersVehicle A · 9 am–12 noon
Maximum one hold per vehicle and overlapping period
R-17 · held for 10 minutesThe second request gets 409 or an alternative.
Explain p95 brieflySort 100 readings: The 95. Value is at most the target. Individual slower requests remain visible.

The mandatory occupancy check protects this rule even in the case of simultaneously arriving write processes.

The search can show a candidate. Only the binding reservation check secures the time window against competing requests.

Business requirements (functional)

Further reading
Function or ruleExpected result
Finding a vehicleShow suitable vehicles, price and time period.
Reserve and cancelSecure occupancy bindingly or release in a controlled manner.
Take over and returnChecking authorization, arranging access and recording usage times.
SettlementDetermine costs from tariff and actual use; assign payment and receipt.
Invariant: at most one effective occupancy per vehicle and time windowThe database also protects competing write operations. A successful search is not yet a promise.
Invariant: Repeat does not create a second orderBooking, payment and vehicle release are each given a stable order identity.
Invariant: Access only with valid booking and authorizationThe server checks the person, vehicle, time period and current operating state at each release.

Finding a vehicle

Expected result
Show suitable vehicles, price and time period.

Reserve and cancel

Expected result
Secure occupancy bindingly or release in a controlled manner.

Take over and return

Expected result
Checking authorization, arranging access and recording usage times.

Settlement

Expected result
Determine costs from tariff and actual use; assign payment and receipt.

Invariant: at most one effective occupancy per vehicle and time window

Expected result
The database also protects competing write operations. A successful search is not yet a promise.

Invariant: Repeat does not create a second order

Expected result
Booking, payment and vehicle release are each given a stable order identity.

Invariant: Access only with valid booking and authorization

Expected result
The server checks the person, vehicle, time period and current operating state at each release.

Invariants are business rules that must be maintained at each permitted state change. Here they concern occupancy, repetition of orders and vehicle release.

Quality goals and their technical implications (non-functional)

Further reading
Commitment / ObjectiveConsequence for the draft
SLO: Search: p95 ≤ 1 s in assumed load profileMeasure response time at the API output. Search data may be at most 30 s stale; the reservation performs the authoritative check.
SLO: Local hold: p95 ≤ 500 msThe short database transaction does not contain an external provider call. Payment confirmation shall then run.
SLO: Booking API: 99.9% per calendar monthMeasure availability separately from domain success and provider responses. A booking conflict is not a failure.

SLO: Search: p95 ≤ 1 s in assumed load profile

Consequence for the draft
Measure response time at the API output. Search data may be at most 30 s stale; the reservation performs the authoritative check.

SLO: Local hold: p95 ≤ 500 ms

Consequence for the draft
The short database transaction does not contain an external provider call. Payment confirmation shall then run.

SLO: Booking API: 99.9% per calendar month

Consequence for the draft
Measure availability separately from domain success and provider responses. A booking conflict is not a failure.

SLO stands for Service Level Objective: a measurable operating goal with a defined measurement point and evaluation period. p95 means: 95% of the measured requests remain below the target value. The specified SLOs are targets for later load and operational tests.

Restricted performance

Search remains informative
A delayed display may lead to a rejected reservation; alternatives are then offered.
Unclear payment remains visible
The status remains pending reconciliation. The application does not confirm a booking solely due to a missing error message.

Terms in this step

Invariant
A rule that is maintained at every permitted state change – for example, an non-overlapping occupancy.
SLO
Service Level Objective: a measurable operational goal, such as the response time of the search or the monthly availability of the booking API.

Try it yourself

Two people reserve vehicle A at the same time for 9-12 o’clock. Formulate a function, an immutable rule, and a measurable goal. How do you check the rule?

A hint for your attempt

The action describes a desire, the rule limits valid results, the goal sets a measured value.

Compare with a possible solution
Function
A person can request an available period of time and read the reservation status.
Invariant and test
At most one effective occupancy may exist. Send two competing reservations: Exactly one can be successful if the vehicle was previously free.
Quality objective
At least 95 % of the searches last a maximum of one second in the assumed load profile. We test this with a load test.

Apply to your project

Transfer the three levels to your own core process and mark which test case shows a domain rejection and which shows a technical failure.

Step 3 translates the quality goals into load assumptions and separates general capacity from contention around a hotspot.