惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
J
Java Code Geeks
雷峰网
雷峰网
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
腾讯CDC
博客园 - 司徒正美
B
Blog RSS Feed
博客园 - 三生石上(FineUI控件)
I
InfoQ
N
Netflix TechBlog - Medium
L
LangChain Blog
博客园_首页
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Tailwind CSS Blog
MyScale Blog
MyScale Blog
美团技术团队
The Cloudflare Blog
爱范儿
爱范儿
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
H
Help Net Security
Martin Fowler
Martin Fowler
V
Visual Studio Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Building a Scalable Booking System: From Manual Schedulin...
Tiago Gomes · 2026-06-19 · via DEV Community

Tiago Gomes

Building a Scalable Booking System: From Manual Scheduling to 24/7 Automation

The Problem

Last year, I was hired to build a booking system for a growing network of barbershops in Portugal. The initial requirements seemed straightforward: let customers book appointments online. But as the system scaled from 5 shops to 50+, we encountered challenges that pushed us to architect a much more complex solution than anticipated.

Initial Architecture: The MVP

We started with a traditional request-response model using Laravel and PostgreSQL:

Client → API → Database → Email Queue → Email Service

Simple. Worked for small traffic. Fell apart under load.

The problem: every booking required:

  • Database write
  • Email notification to barber
  • Email confirmation to client
  • Calendar sync to 3 different integrations
  • SMS reminder scheduling

All synchronously. A single slow operation blocked the entire request.

The Scale Problem

By month 6, we had:

  • 50 barbershops
  • 3,000 daily bookings
  • Response times degrading from 200ms to 2-3 seconds
  • Customers receiving confirmations 30+ seconds after booking

The synchronous model wasn't viable anymore.

The Solution: Async Everything

We restructured the system using RabbitMQ for message queuing:

Client → API (Fast) ↓
         Queue → Workers (Parallel Processing)
              ├→ Email Worker
              ├→ SMS Worker
              ├→ Calendar Sync Worker
              ├→ Analytics Worker
              └→ Notification Worker

Result: API response time dropped from 2.5s back to 180ms. Customers got instant confirmation.

Key Technical Decisions

1. Database Design for Concurrency

We implemented optimistic locking for appointment slots:

CREATE TABLE appointments (
    id BIGINT PRIMARY KEY,
    barber_id BIGINT,
    time_slot_id BIGINT,
    customer_id BIGINT,
    version INT DEFAULT 1,
    status ENUM('pending', 'confirmed', 'completed', 'cancelled'),
    created_at TIMESTAMP,
    updated_at TIMESTAMP,
    UNIQUE KEY(time_slot_id, version)
);

Why? Double-booking prevention without expensive locks. The version column ensures atomic updates only succeed if no other process modified the record.

2. Handling Timezone Complexity

One issue that surprised us: international clients booking across timezones.

// Store everything in UTC internally
$appointment = Appointment::create([
    'scheduled_at' => $request->scheduled_at->setTimezone('UTC'),
    'barber_timezone' => $barber->timezone,
    'customer_timezone' => Auth::user()->timezone,
]);

// Return in client's timezone
return $appointment->scheduled_at
    ->setTimezone($customer->timezone)
    ->format('Y-m-d H:i');

3. Queue Reliability

We learned the hard way: message queues need dead-letter handling.

// Retry failed jobs with exponential backoff
Queue::job(SendConfirmationEmail::class)
    ->tries(5)
    ->backoff([1, 5, 10, 30, 60]) // seconds
    ->retryUntil(now()->addHours(24))
    ->dispatch($appointment);

Failed emails went to a dead-letter queue for manual review instead of silently failing.

Performance Metrics

After optimization:

Metric Before After Change
API Response Time 2.5s 180ms 93% faster
Booking Success Rate 94% 99.7% Double-booking eliminated
Customer Satisfaction 3.2/5 4.7/5 Faster confirmations
Concurrent Bookings 5/second 150/second 30x capacity

What We'd Do Differently

  1. Start with async from day 1 - We rebuilt the entire queue system mid-growth. Painful.
  2. Implement monitoring earlier - We discovered bottlenecks through customer complaints, not dashboards.
  3. Test edge cases more - 11 PM bookings, midnight hour transitions, daylight saving time were nightmares to debug in production.

The Lesson

A booking system is a concurrency problem disguised as a scheduling problem. The business logic is simple. The engineering is not.

The moment you have:

  • Multiple users competing for the same resource (appointment slots)
  • Time-sensitive operations (confirmations must be instant)
  • Distributed workers (multiple integrations)

...you need a system designed for concurrency, not convenience.


Have you built distributed systems with similar challenges? Share your approach in the comments — especially if you solved the timezone problem better than we did!