Skip to content
SD-53 · Back to the write-up

Design a Parts Compatibility

Check and compile supplier rules into a vehicle set per part, then answer fit checks from that set and searches from an index with vehicle ids.

Follow a request

Clients
Edge
Services
Data and pipeline
ShopperWeb or app
SupplierUploads feeds
CDNSelector + pages
Load balancerSpreads traffic
App serversStateless
Fit cacheHot parts
Fitment storepart → vehicles
Search indexFilter by vehicle
Validate + compilePer feed
Rules DBSource of truth
1shopper → lb · GET /parts/8812/fitA shopper with vehicle 1203 active opens a brake pad page.1 / 6

The numbers, at a glance

Of every 10 product views……9 are answered by the fit cache
9 cache hits1 store lookup
Fitment data, raw vs compiledGigabytes to answer “does it fit?”
Wrong answers from raw feedsBefore validation
≈ 25,000 returns a day. Validation brings it under 0.1%.

A fit check, in order

Cache miss shown. On a hit, steps 4 and 5 disappear.

Shopper
Load balancer
App server
Fit cache
Fitment store
1 GET /parts/5530/fit?vehicle_id=1203
2 route
3 GET fit:5530
4 miss: GET part 5530
5 set v42 + notes
6 set v42
7 fits with notes
8 200 + question
RequestResponseAsync, does not block

How a fit check is answered

The decision this question is really about.

Evaluate rules
Too slow
GET fit
JOIN 300M rules
10 work units a check
+ Always fresh.− A join per request.
Every pair in a table
Heavy
GET fit
fitment(part, vehicle)
120 GB; feeds rewrite millions
+ Key lookups.− 2B rows; big rewrites.
Compiled sets
Our pick
Feed → validate → compile
part → vehicle setindex: fits field
Cache hot sets
+ One lookup; 10 GB; cacheable.− A compile step per feed.

How it grows

Add a box only when a number forces you to. Highlighted boxes are new at each stage.

Stage 1 · ≈ 200 req/sMake it work
Shopper
App server
SQL database
One server; rules joined per request.
Stage 2 · ≈ 1,000 to 2,000 req/sIndex the search
Shopper
Load balancer
App × N
Search indexSQL database
Vehicle ids on every search document; app servers behind a load balancer.
Stage 3 · ≈ 10,000 req/sCompile the rules
ShopperSupplier feeds
Load balancerValidator
App × NCompiler
Search indexFitment storeRules DB
Validate each feed and compile it into a vehicle set per part.
Stage 4 · ≈ 30,000 req/sHoliday peak
ShopperSupplier feeds
CDNValidator
App × NFit cacheCompiler
Search indexFitment storeRules DB
Category pages at the edge, and a fit cache for hot parts.
Was this walkthrough useful?Your vote tells us what to improve next.