AlgoMaster Logo

Matchmaking Pattern in System Design

8 min readUpdated June 23, 2026
Listen to this chapter
Unlock Audio

Matchmaking Pattern in System Design

You click "Play" on Chess.com and within seconds, you are paired with an opponent of similar skill from anywhere in the world. On Tinder, you swipe through profiles curated specifically for your preferences. In League of Legends, five players are assembled into a team balanced against another team of five.

Behind all these experiences is matchmaking, a core system design pattern that pairs users based on compatibility criteria while optimizing for speed and fairness.

Matchmaking appears in almost every system design interview involving real-time pairing: online games, dating apps, ride-sharing, job platforms, and tutoring services. This problem calls for understanding the trade-offs between match quality and wait time, designing efficient queue structures, and handling the complexities of distributed matching at scale.

In this article, we will explore the matchmaking pattern in depth, understand different algorithms and their trade-offs, and learn how to design matchmaking systems for various use cases.

If you're enjoying this newsletter and want to get even more value, consider becoming a paid subscriber.

As a paid subscriber, you'll unlock all premium articles and gain full access to all premium courses on algomaster.io.

Unlock Full Access

What is Matchmaking?

Matchmaking is the process of pairing two or more users based on compatibility criteria. The goal is to create fair, enjoyable, or productive pairings while minimizing the time users spend waiting.

Five players with different ratings enter the waiting queue, and the matchmaker pairs them by proximity in skill, producing two matches with a rating gap of just 20 points each.

The core tension in matchmaking is between two competing goals:

GoalDescription
Match QualityPairing users who are well-suited for each other
Match SpeedMinimizing wait time for users

These goals often conflict. Finding the perfect match might take minutes, but users expect to be matched in seconds. Every matchmaking system must navigate this trade-off.

Where Matchmaking is Used

Scroll
DomainUse CaseKey Criteria
Online GamesChess, multiplayer games, battle royaleSkill rating, latency, party size
Dating AppsTinder, Bumble, HingeLocation, preferences, mutual attraction
Ride-SharingUber, LyftLocation, ETA, vehicle type
Job PlatformsLinkedIn, IndeedSkills, experience, location, salary
TutoringWyzant, PreplySubject, availability, price
E-SportsRanked matches, tournamentsTeam composition, rank, region
Support SystemsCustomer service routingIssue type, agent expertise, wait time

Each domain has unique constraints, but the fundamental pattern remains the same: maintain a pool of waiting users, evaluate compatibility, and create pairings that satisfy both quality and speed requirements.

The Quality vs Speed Trade-off

This is the most important concept in matchmaking. You cannot optimize for both perfect matches and instant matching simultaneously.

Most systems solve this with expanding windows: start with strict criteria, then gradually relax them as wait time increases.

Scroll
Wait TimeRating WindowExample (1500 rated player)
0-15s± 50Matches with 1450-1550
15-30s± 100Matches with 1400-1600
30-60s± 200Matches with 1300-1700
60s+± 400Matches with 1100-1900

Core Challenges

1. The Cold Start Problem

When there are few users in the queue, finding good matches is difficult.

Solutions

  • Expand matching criteria over time
  • Use bots or AI opponents during low activity periods
  • Show estimated wait times to set expectations
  • Implement cross-region matching during off-peak hours

2. The Imbalanced Pool Problem

Some user segments may have far more supply than demand.

Solutions

  • Adjust algorithms to account for supply/demand imbalance
  • Implement activity limits (daily swipes, matches)
  • Surface less active profiles to balance exposure
  • Different UX for different user segments

3. The Latency Problem

In games, network latency directly affects gameplay quality.

Trade-off decision: Better skill match vs better connection quality.

Solutions

  • Region-based queue segmentation
  • Latency-aware matching with ping estimation
  • Let users choose: "Fast match" vs "Quality match"
  • Cross-region matching only as last resort

4. The Party/Group Problem

When users queue as groups, matching becomes a constraint satisfaction problem.

Solutions

  • Match groups against groups of similar size
  • Apply skill handicap (5-stack vs solos needs rating adjustment)
  • Separate queues for solo vs party
  • Limit party size disparity in matches

Matchmaking Algorithms

Algorithm 1: Simple Range Matching

The most straightforward approach. Match players whose ratings fall within a range of each other.

How it works

  1. Player joins queue with rating R
  2. Look for players in range [R - window, R + window]
  3. If found, create match with closest rating
  4. If not found, expand window and retry
ProsCons
Simple to implementCan create unfair matches when windows expand
Predictable behaviorGreedy approach, not globally optimal
Easy to tunePoor handling of multiple criteria

Algorithm 2: Score-Based Matching

Assign a compatibility score to each potential pairing and create matches that maximize total score.

Score calculation example:

Scroll
FactorCalculationPoints
Base scoreStarting value100
Rating difference-1 point per 10 rating gap-0 to -50
Wait time bonus+1 point per 5 seconds waited+0 to +20
Latency penalty-1 point per 10ms over 50ms-0 to -30
Same region bonusFixed bonus+10

A player pair with 50 rating difference, 30 second average wait, same region, and 40ms latency would score: 100 - 5 + 6 + 10 = 111 points.

Optimization approaches:

Scroll
ApproachHow It WorksComplexity
GreedyPick best pair, remove, repeatO(n²)
Optimal (Hungarian)Find globally optimal matchingO(n³)
BatchCollect players for 5s, then optimizeConfigurable
ProsCons
Considers multiple factorsMore complex to implement
Can optimize globallyOptimal matching is expensive at scale
Flexible scoringHarder to explain to users

Algorithm 3: Elo-Based Expected Outcome Matching

Used in competitive games. Match players such that the expected outcome is close to 50-50.

Win probability formula:

Rating ranges for fair matches (45-55% win chance):

Your RatingFair Opponent Range
12001130 - 1270
15001430 - 1570
18001730 - 1870
22002130 - 2270

The fair range is approximately ± 70 rating points for a 45-55% expected outcome.

ProsCons
Creates competitive matchesNarrow range increases wait times
Based on proven statistical modelRequires accurate ratings
Players understand the fairnessNew players are problematic

Algorithm 4: Bucket/Tier-Based Matching

Divide players into skill tiers and match within tiers.

Handling tier boundaries:

Players at the edge of tiers (e.g., 1395 Silver vs 1405 Gold) may have long waits. Solutions:

  1. Overlap zones: Allow ± 50 points at tier boundaries
  2. Soft boundaries: After 30 seconds, search adjacent tiers
  3. Display tiers, match on rating: Show Bronze/Silver for UX, but match on actual rating
ProsCons
Simple and intuitive for usersArtificial boundaries at edges
Fast O(1) matching within tiersTop/bottom tiers have longer waits
Easy to parallelizeLess granular than pure rating

Algorithm 5: Glicko-2 Confidence-Based Matching

Consider rating uncertainty when matching. New players and inactive players have uncertain ratings.

Key insight: A player with high rating deviation (RD) has an uncertain rating. Matching them helps calibrate their true skill faster.

Glicko-2 tracks three values:

ValueMeaning
Rating (r)Skill estimate (like Elo)
Rating Deviation (RD)Uncertainty in rating (higher = less certain)
Volatility (σ)Expected fluctuation over time

The matching strategy follows from this. Match uncertain players against established players so the system calibrates them faster, and prefer matches where the two confidence intervals overlap. RD increases over time for inactive players, so a returning player is treated as uncertain again until a few matches narrow the estimate.

ProsCons
More accurate for new/returning playersMore complex to implement
Naturally handles rating uncertaintyHarder to explain to users
Better long-term accuracyRequires tracking additional state

System Architecture

The following diagram shows the full request path from players through the API layer to the regional matchmakers, the shared data stores they read from, and the game server coordinator that receives the final match assignment.

Core Components

ComponentPurpose
API GatewayHandles queue join/leave requests, authentication
WebSocket ServerMaintains connections, notifies players when match is found
Matchmaker ServiceRuns matching algorithm, creates matches (one per region)
RedisStores waiting queue as sorted set (by rating), player state
Rating DatabasePlayer ratings, match history, statistics
Game Server CoordinatorAllocates game servers for created matches

Queue Data Structure

Use Redis Sorted Sets for efficient range queries:

Scroll
OperationDescriptionComplexity
Add playerInsert with rating as scoreO(log n)
Find in rangeGet players within rating windowO(log n + k)
Remove playerDelete after match or cancelO(log n)

This allows finding all players rated 1400-1600 instantly, regardless of queue size.

Matchmaker Loop

The matchmaker runs continuously:

Handling Edge Cases

Player Disconnects While Waiting

When a player drops from the queue, the system must decide whether a match was already in progress and respond accordingly, either canceling it and returning the other player to the front of the queue, or simply removing the disconnected player with no further action.

Match Found But Player Declines

Many games require players to accept/decline:

Long Wait Times

When a player waits too long:

OptionDescription
Force matchMatch with best available, even if poor quality
Offer alternativeSuggest playing vs AI or different game mode
Notify and waitShow estimated time, let player decide
Cross-regionExpand search to other regions

Smurf Detection

Smurfs are skilled players using new accounts to stomp weaker opponents.

Detection signals

  • New account with extremely high win rate
  • Performance metrics far above expected level
  • Suspicious account patterns

Solutions

  • Accelerate rating gains for suspected smurfs
  • Place in separate "smurf queue"
  • Shadow ban (longer queue times)

Team Matchmaking

Matching teams adds significant complexity.

Team Rating Calculation

Three common methods translate individual player ratings into a single team rating: a simple average, a weighted average that gives more influence to the strongest player, and a variance-adjusted value that penalizes teams whose skill distribution is uneven.

MethodWhen to Use
Simple AverageCasual games, equal contribution
Weighted AverageGames where one player can carry
Variance-AdjustedPenalize teams with skill gaps

Party Size Matching

Matching parties of similar size keeps communication advantages balanced, while mixing a full five-stack against five solo players creates an inherent coordination edge that raw rating adjustment cannot fully compensate for.

As a rule, prefer matching similar party compositions against each other. When a mismatch is unavoidable, adjust the rating expectations to compensate, and track win rates by party composition over time so the adjustment stays calibrated to real outcomes.

Role-Based Composition

Games with roles (tank, healer, DPS) need balanced teams:

Solutions

  • Show queue times by role before selection
  • Incentivize less popular roles (bonus rewards)
  • Allow "flex" players who accept any role

Metrics and Monitoring

Key Quality Metrics

Scroll
MetricDescriptionTarget
Average Wait TimeTime from queue join to match< 60 seconds
P95 Wait Time95th percentile wait< 3 minutes
Rating DifferenceAverage skill gap in matches< 100 points
Win Rate FairnessHigher rated player win %50-55%
Match Completion Rate% of matches that finish> 95%
Queue AbandonmentPlayers who leave queue< 10%

Monitoring Dashboard

Real-time metrics for queue size, wait-time percentiles, and rating gaps feed directly into an alerting layer that fires when any of those values cross a configured threshold.

Interview Tips

1. Start With Requirements

Ask clarifying questions before designing:

QuestionWhy It Matters
How many concurrent users seeking matches?Determines scaling approach
What criteria determine a good match?Defines algorithm complexity
What is acceptable wait time?Sets quality/speed trade-off
Are there groups/parties?Adds constraint complexity
Regional or global matching?Affects architecture

2. Discuss Trade-offs

Always mention the core trade-off:

3. Design Incrementally

Build complexity step by step:

4. Mention Real Systems

Reference real implementations:

  • "Riot Games uses a complex score-based system for League of Legends"
  • "Chess.com uses Glicko-2 for rating with uncertainty tracking"
  • "Uber's matching considers location, ETA, and driver preferences"
  • "Overwatch 2 has role-based queues to ensure team composition"

Summary

The diagram maps the three layers every matchmaking system must address: the core concepts that govern every design decision, the algorithm options to choose from based on requirements, and the infrastructure choices that make the system work at scale.

Scroll
AlgorithmBest ForComplexity
Simple RangeQuick MVP, low scaleO(n)
Score-BasedMultiple criteriaO(n²)
Elo-BasedCompetitive fairnessO(n)
Tier/BucketVery high scaleO(1) per tier
Glicko-2New/returning playersO(n)

Key takeaways

  1. Trade-off is fundamental: Quality vs speed, always discuss it
  2. Start simple: Range matching with expanding windows works for most MVPs
  3. Consider multiple factors: Rating, wait time, latency, preferences
  4. Handle edge cases: Disconnects, cancellations, long waits, smurfs
  5. Teams add complexity: Party size, role balance, team rating calculation
  6. Monitor and iterate: Track metrics, adjust algorithm based on data

Thank you for reading!

If you found it valuable, hit a like and consider subscribing for more such content every week.

If you have any questions or suggestions, leave a comment.

This post is public so feel free to share it.

Share

P.S. If you're enjoying this newsletter and want to get even more value, consider becoming a paid subscriber.

As a paid subscriber, you'll unlock all premium articles and gain full access to all premium courses on algomaster.io.

Unlock Full Access

There are group discounts, gift options, and referral bonuses available.

Checkout my Youtube channel for more in-depth content.

Follow me on LinkedIn and X to stay updated.

Checkout my GitHub repositories for free interview preparation resources.

I hope you have a lovely day!

See you soon,

Ashish

Quiz

Matchmaking Quiz

20 quizzes