System Design Atlas

Rental and sharing system

03 / 10Worked example

Scale estimates

What burden does our design have to deal with?

Our assumed daily amounts become a load profile. In addition to the entire throughput, we check the contention for a single popular vehicle: a hotspot.

Starting point From step 2: Search, hold and booking have their own quality goals; vehicle A may not be occupied twice in the time window 9-12 o'clock.

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.

From assumptions to test decisions

Illustrative assumptions for the load profile

Units

200,000 searches/day and 2,000 bookings/day

86,400 seconds per day

Average

≈ 2.31 searches/s and ≈ 0.023 bookings/s

Daily amount ÷ 86,400

Peak × 20

≈ 46 searches/s and ≈ 0.46 bookings/s

Average × assumed peak factor

Common scale: operations per second to the top

Searches
46/s
Bookings
0.46/s

Ratio in the example: approximately 100 searches per booking. This corresponds to 0.46 bookings/s or about 1% of the scale.

Hold test 1 · K-17Hold-attempt 2 · other keysFurther request · Vehicle A
Hotspot: same occupancyTotal load and contention to test vehicle A separately: measure conflict rate, waiting time and clear rejections.

The figures are illustrative design assumptions. A load test checks throughput, response time and conflict behavior at the actual expiration.

Assumptions determine the test profile. A load test checks the capacity; a contention test checks the occupancy rule at the hotspot.

Estimating load and data growth

Further reading
  1. 01

    Search requests

    ≈ 46 searches/s at peak

    10,000 active people/day × 20 search = 200,000 search/day; ÷ 86,400 s ≈ 2.3 search/s on average; × 20 ≈ 46 search/s at peak.

    For the designThe search is supposed to process around 46 requests per second at the assumed peak. This processed quantity per unit of time is called throughput. In the load test, we check whether the response time target from step 2 is adhered to: 95% of the searches last at most one second.

  2. 02

    Bookings

    ≈ 0.46 bookings/s at peak

    2,000 bookings/day ÷ 86,400 s ≈ 0.023 bookings/s on average; × 20 ≈ 0.46 bookings/s at peak.

    For the designOver the entire stock, the peak corresponds to about one booking every two seconds. Individual vehicles can still receive many simultaneous reservation attempts. Therefore, we check the total load and the contention for the same vehicle separately. Rejected and repeated attempts are added to the number of successful bookings.

  3. 03

    Booking writes

    ≈ 4.6 changes/s at peak

    2,000 bookings/day × assumed 10 changes = 20,000 changes/day; ÷ 86,400 s ≈ 0.23 changes/s on average; × 20 ≈ 4.6 changes/s to peak.

    For the designA booking stores several changes, such as reservation, payment status and events. In the load test, we therefore map the complete booking process. The ten changes are an assumption; we measure the actual database accesses by the implementation.

  4. 04

    Reservation data

    ≈ 1.46 GB/year

    2,000 bookings/day × 365 days = 730,000 reservations/year; × assumed 2 kB = 1.46 GB/year (decimal).

    For the designIf the booking number remains the same, approximately 7.3 GB of pure reservation data will be generated in five years. For the database test, we therefore also use a stock that has grown over several years. Indices, backup copies, logs, photos and other business data are additionally planned.

Optimize search and manage booking data together

Further reading
Accelerating frequent search queries
200,000 searches ÷ 2,000 bookings = 100 searches per booking. Even one expensive search query therefore runs frequently. We first check the queries for location, vehicle and time period and suitable database indices. An index helps to find suitable data sets in a targeted manner. The 100:1 ratio describes business operations; the database also counts all read and write accesses within these operations.
Check a relational SQL database as a starting point
Vehicles, bookings and usage times are in clear relationships. When booking, availability check and new occupancy must be correctly executed together. A relational SQL database with transactions can support these requirements. The business rules from step 2 speak for this. The quantities calculated here determine the load profile with which we check suitability. We will choose the specific database product later.
Starting with a joint booking datastore
For the estimated 4.6 changes per second and 1.46 GB of new reservation data per year, we first check a jointly managed database. In this way, vehicle occupancy and booking can be changed together within a database. Dividing it into several databases would require additional coordination. Whether the common stock reaches the response time targets also depends on queries, indices and hardware and is checked in the load test.

Test capacity and booking conflicts separately

Test mixed load capacity
Test search and booking requests, status queries and returns together, even with grown data. Measure throughput, response times and load. GPS messages would be an additional load share.
Targeted contention
Many requests simultaneously reserve vehicle A for 9-12 o'clock. At most one assignment may take effect; the other requests need a clear, timely rejection.

Terms in this step

Throughput
The amount processed per unit of time, here about 46 searches per second. The load test checks whether the system reaches this throughput within the required response times.
Hotspot
A highly demanded part of the datastore, here the occupancy of a popular vehicle. Many simultaneous accesses to it can cause waiting times, although the remaining stock receives little load.

Try it yourself

The search volume doubles to 400,000 per day; 2,000 bookings and peak factor 20 remain the same. Calculate both peak values. Do we still need a test for vehicle A?

A hint for your attempt

Calculate daily amount per operation ÷ 86,400 seconds × 20. After that, consider the contention for a single vehicle.

Compare with a possible solution
Peak search load
400,000 ÷ 86,400 × 20 ≈ 92.6 search/s. The ratio increases to 200 searches per booking.
Peak booking load
2,000 ÷ 86,400 × 20 ≈ 0.46 bookings/s. The booking profile remains the same at first; repetitions and rejections are added.
Hotspot
Yes. Even at low total load, many requests can compete for vehicle A. The test must exclude double occupancy.

Apply to your project

Transfer the computational chain and the hotspot test to your own project and write about which measurement would later confirm or refute the assumption.

Step 4 describes the interfaces that turn search, hold and later result into clear requests and answers.