Prompt
How do I set up a programmatic guaranteed platform for guaranteed inventory reservation?
Latest observation
To set up a programmatic guaranteed (PG) platform for guaranteed inventory reservation, you need a system that can do three things reliably:
- Reserve inventory up front
- Enforce delivery against that reservation
- Reconcile delivery vs. commitment accurately
Here’s a practical blueprint.
1) Define the core PG model
At minimum, your platform needs these entities:
- Advertiser / Buyer
- Campaign / Deal
- Publisher / Supply source
- Placement / Inventory segment
- Reservation
- Impression delivery
- Billing / reconciliation
A PG deal usually includes:
- Fixed inventory amount or fixed budget
- Fixed pricing model, often CPM
- Start/end dates
- Targeting constraints
- Delivery guarantees
- Makegood or penalty rules if under-delivered
2) Build an inventory ledger
A guaranteed reservation system should not rely on “best effort” counters. It needs a transactional inventory ledger.
Recommended inventory states
For each inventory unit or segment, track:
- Available
- Soft reserved
- Hard reserved
- Consumed
- Released
- Expired
Why this matters
When a buyer books guaranteed inventory, you must immediately reduce the sellable supply so it cannot be double-sold.
Reservation logic
Use an atomic operation like:
- check availability
- create reservation record
- decrement available pool
- increment reserved pool
This should happen in a single transaction or via a strongly consistent distributed workflow.
3) Decide your reservation granularity
You need to choose what exactly is being reserved:
Options
- Impression-level
- Audience-segment-level
- Contextual placement-level
- Package-level / guaranteed line item
- Time-block / daypart-level
Best practice
Most PG systems reserve at a forecasted supply segment level, not individual impressions. For example:
- “1M impressions on sports homepage in US during March”
- “500k impressions to women 25–34 across mobile app inventory”
You then translate that to delivery allocation rules later.
4) Implement supply forecasting
Guaranteed inventory only works if you can predict supply.
Forecast inputs
- Historical impressions
- Seasonality
- Traffic trends
- Fill rates
- Viewability thresholds
- Device / geo / audience distribution
- Content traffic patterns
Forecast outputs
- Estimated impressions available by segment
- Confidence intervals
- Safety buffers / overbooking tolerance
Important
Do not reserve 100% of forecasted supply. Keep a buffer for uncertainty.
Example:
- Forecast: 10M impressions
- Safety reserve: 10–20%
- Sellable PG capacity: 8–9M impressions
5) Create a reservation service
This should be its own service or module.
Responsibilities
- Validate deal eligibility
- Check supply availability
- Create reservation
- Lock inventory
- Support cancellation / expiry
- Track partial fulfillment
- Expose reservation status API
Suggested API endpoints
POST /reservationsGET /reservations/{id}POST /reservations/{id}/cancelPOST /reservations/{id}/confirmPOST /reservations/{id}/adjust
Required fields for a reservation
- Deal ID
- Inventory segment ID
- Reserved quantity
- Start/end times
- Targeting constraints
- Price
- Priority
- Status
6) Use a delivery engine that honors reservations
Your ad serving / decisioning layer must check reserved commitments before serving any available impression.
Serving flow
- Impression request arrives
- System evaluates eligibility
- System checks guaranteed reservations first
- If a matching reservation exists and delivery remains, serve PG ad
- Otherwise, fall back to non-guaranteed demand
Important
This requires priority-aware decisioning so PG inventory cannot be displaced by lower-priority demand.
7) Add pacing and delivery controls
Reserved inventory needs pacing so delivery is spread across the flight.
Pacing controls
- Uniform pacing
- Front-loaded
- Back-loaded
- Daypart pacing
- Budget-based pacing
Example
If a campaign reserved 1M impressions over 30 days:
- target ~33k/day
- adjust dynamically based on actual supply
- compensate if delivery lags or spikes
Pacing should be tied to both:
- budget spend
- impression delivery
- remaining time
8) Build reconciliation and reporting
Guaranteed deals require accurate accounting.
Track
- Reserved
- Delivered
- Remaining
- Under-delivered
- Over-delivered
- Adjusted / makegood amounts
Reconciliation logic
At the end of the campaign:
- compare reserved quantity vs delivered quantity
- determine shortfall or overdelivery
- apply billing rules
- generate invoice or makegood plan
9) Support makegoods and fallback logic
If inventory cannot be delivered as promised, the system should handle it gracefully.
Makegood options
- Deliver extra impressions later
- Shift to alternate inventory
- Extend flight dates
- Upgrade placement
- Provide credits/refunds
This should be part of your deal contract model.
10) Handle concurrency and double-booking carefully
This is one of the hardest parts.
Use:
- Database transactions
- Row-level locks
- Optimistic concurrency control
- Idempotency keys
- Reservation versioning
Example issue
Two buyers try to reserve the last 100k impressions at the same time.
You need atomic reservation logic so only one succeeds or both receive partial allocation based on business rules.
11) Recommended architecture
A practical PG platform architecture:
- Deal Management Service
- Forecasting Service
- Inventory Ledger Service
- Reservation Service
- Ad Decisioning / Serving Service
- Billing / Reconciliation Service
- Reporting / Analytics Service
Event-driven flow
Use events like:
ReservationCreatedReservationAdjustedImpressionServedReservationConsumedCampaignCompleted
A message bus helps keep systems in sync.
12) Data model essentials
You’ll likely need tables/collections like:
Reservation
- id
- deal_id
- segment_id
- quantity_reserved
- quantity_delivered
- status
- start_date
- end_date
- priority
- price
- created_at
InventorySegment
- id
- name
- forecast_quantity
- available_quantity
- reserved_quantity
- confidence_score
DeliveryLog
- id
- reservation_id
- impression_id
- timestamp
- placement
- geo
- device
- cost
13) Enforce contract rules
Your PG platform should validate deal constraints like:
- only certain geos
- allowed devices
- minimum viewability
- brand safety categories
- frequency caps
- floor pricing or fixed price
- buyer seat permissions
If an impression doesn’t satisfy the deal, it should not consume reserved inventory.
14) Consider overbooking strategy
Some PG systems intentionally sell slightly more than forecast, based on historical reliability.
Example
If you forecast 100M impressions and sell 103M:
- this works only if fulfillment confidence is high
- requires strict monitoring
- must have fallback inventory
This is a business decision and a risk model, not a default.
15) Start with an MVP
For an MVP, implement:
- Forecast inventory by day/segment
- Reserve inventory in a transactional database
- Serve PG first
- Track delivery against reservation
- Reconcile at campaign end
Do not start with hyper-granular optimization. Get correctness first.
16) Key non-functional requirements
You’ll need:
- High availability
- Low-latency decisioning
- Strong consistency for reservations
- Audit logs
- Retry-safe APIs
- Monitoring and alerting
- Fraud / invalid traffic protection
17) Common pitfalls
- Reserving based on raw traffic without buffers
- No atomic inventory lock
- Not distinguishing reserved vs delivered
- Ignoring targeting constraints in reservation math
- No makegood workflow
- Overly optimistic forecasting
- Using only eventual consistency for reservation decisions
18) Minimal recommended workflow
- Publisher forecasts available inventory
- Buyer books PG deal
- System reserves capacity
- Serving engine prioritizes reservation
- Impressions consume reserved pool
- Delivery is monitored continuously
- Shortfalls trigger makegood/reallocation
- Final reconciliation and billing
If you want, I can also provide:
- a system architecture diagram,
- a sample database schema, or
- pseudocode for atomic inventory reservation.