Designing a Real-Time Load Bidding Platform (Uber Freight)

Difficulty: Advanced Topics: Real-Time Auction, WebSocket, Event-Driven, Concurrency, Sorted Sets Asked at: Uber Freight, Convoy, Loadsmart, Amazon Logistics, Flexport · Prerequisites: Message Queues, WebSockets, Caching, and Distributed Locking


1. Understanding the Problem

A load bidding platform is a real-time auction marketplace for freight. Shippers post loads (cargo that needs to move from A to B), and carriers (truck owners) compete by placing bids – offering a price and pickup time. All bidders see new bids appear live without refreshing. When the auction closes (time expires or shipper accepts a bid), exactly one carrier wins and gets the booking. The challenge is handling concurrent bids at scale while maintaining real-time fan-out and ensuring exactly-one-winner semantics at auction close.
💡 Fan-out = one event having to reach many recipients. Here a single bid must land on every screen watching that load, so the cost of a write is multiplied by the size of the audience.


2. Naive First Cut

flowchart LR
    Shipper["Shipper App"]
    Carrier["Carrier App"]
    API["API Server"]
    DB["Postgres DB"]

    Shipper --> API
    Carrier --> API
    API --> DB

How this breaks:

  • Every bid writes to Postgres and then all other carriers must poll to see new bids – 50K carriers watching 5-10 loads each is 500K watch relationships, and a 5-second poll on each is ~100K requests/sec
  • Determining the current best bid requires SELECT * FROM bids WHERE load_id=? ORDER BY price LIMIT 1 on every view – index contention at write scale
    💡 Index contention = reads and writes fighting over the same index pages. Every new bid has to update the index that every “who is winning?” query is simultaneously reading. Learn more →
  • When auction closes, two concurrent processes might both read the same “best bid” and create two bookings – double-award
  • Carriers watching a load see bids with 5-10 second delay (polling interval) – in a competitive auction, stale data means unfair bidding
  • No durability story – if the API server crashes between accepting a bid and writing to DB, the bid is lost permanently
  • Carrier places a bid, refreshes, doesn’t see it yet – confusing user experience (UX) due to replication lag
    💡 Replication lag = the delay before a copy of the database catches up with the original. If the refresh lands on a copy that is half a second behind, the carrier’s own bid is genuinely not there yet.

The rest of the doc evolves this into a production-grade auction system.


3. Prior Art We’re Drawing From

  • Uber Freight Carrier Marketplace – Scoring-based matching where carriers see available loads ranked by relevance. Loads can be “instant book” (first-come) or auction-style where the best bid wins. (Uber Freight Engineering)
  • Google Ad Exchange (AdX) – Real-time bidding at millisecond scale (100ms auction window). Uses in-memory bid aggregation and pub/sub for result delivery. The pattern of “collect bids in a time window, pick winner, notify all” is directly applicable to freight auctions. (Google Ad Manager Docs)
  • eBay Auction Architecture – Pioneered anti-sniping (extend auction if late bid arrives), bid history fan-out to watchers, and optimistic concurrency on bid placement. (eBay Tech Blog)
    💡 Optimistic concurrency = don’t lock anything; just check at write time that nobody changed the row underneath you, and retry if they did. Deep Dive 2 uses exactly this to stop two closers awarding one load.
  • Redis Sorted Sets for Leaderboards – Gaming platforms use ZADD/ZRANGE for real-time leaderboards at 100K+ updates/sec. Same pattern applies to bid ranking where score = price. (Redis Best Practices)
  • Kafka Event Sourcing for Financial Systems – Stripe and Square use Kafka as the source of truth for financial events, enabling replay and audit trails. Bid events have similar durability requirements – you need a complete audit trail of who bid what and when.
    💡 Event sourcing = store the ordered list of things that happened, and treat every table as a view you can rebuild by replaying it. It is why a lost Redis leaderboard here is an inconvenience rather than a data loss.

4. Functional Requirements

Core (Top 3)

  1. Shipper posts a load for auction – origin, destination, weight, max budget, auction duration. Eligible carriers are notified.
  2. Carriers place bids in real-time – bid a price and estimated pickup time. All watchers see new bids appear live (< 500ms latency).
  3. Auction closes and winner is determined – when time expires or shipper accepts a bid, exactly one carrier wins. Booking is created atomically.