Wiki › Tier 1

System Design & Databases

182 bookmarks · Last synthesized Jun 3, 2026

System Design & Databases

This page serves as a reference for core system design methodologies, database administration practices, and database performance principles derived from industry-standard engineering practices.


1. System Design & Architectural Decision-Making

Designing scalable software systems requires structured decision-making, quantitative analysis, and rigorous documentation.

  • Quantitative Design Selection: It is highly recommended to use back-of-the-envelope calculations to evaluate and choose the best system design for a given set of requirements.
  • Documenting Decisions: Architects and developers should always document the rationale behind database choices to ensure long-term maintainability and alignment across teams.
  • System Design Resources: Specialized architectures, such as online gaming protocols, serve as valuable system design refreshers for understanding low-latency, real-time data flow.
  • Architectural Mindset: Top-tier software architects act as amplifiers, making teams smarter rather than being oracles. They focus on making complex decisions understandable and lowering overall project risk.

Deep Dive: Back-of-the-Envelope Calculations

To evaluate and choose the best design alternative without building them first, software architects use thought experiments combined with key latency numbers (fostered by Jeff Dean of Google) to estimate system performance.

Latency Numbers Everyone Should Know

  • L1 cache reference: 0.5 ns
  • Branch mispredict: 5 ns
  • L2 cache reference: 7 ns
  • Mutex lock/unlock: 100 ns
  • Main memory reference: 100 ns
  • Compress 1K bytes with Zippy: 10,000 ns (10 µs)
  • Send 2K bytes over 1 Gbps network: 20,000 ns (20 µs)
  • Read 1 MB sequentially from memory: 250,000 ns (250 µs)
  • Round trip within same datacenter: 500,000 ns (500 µs / 0.5 ms)
  • Disk seek: 10,000,000 ns (10 ms)
  • Read 1 MB sequentially from network: 10,000,000 ns (10 ms)
  • Read 1 MB sequentially from disk: 30,000,000 ns (30 ms)
  • Send packet CA -> Netherlands -> CA: 150,000,000 ns (150 ms)

Key Architectural Principles:

  • Leverage Compression: Using a cheap compression algorithm (like Zippy) to reduce data size before transmission saves valuable network bandwidth (often by a factor of 2) with minimal CPU overhead.
  • Design for Write Scaling: Writes are roughly 40 times more expensive than reads. Systems should be designed to optimize for low write contention and scale "wide" by parallelizing writes as much as possible.
  • Avoid Global Shared Data: Lock contention in heavily-written shared objects kills distributed system performance as transactions serialize.

The Architect's Role: Risk Management and Communication

Top-tier architects are distinguished by their ability to manage risk and communicate effectively across technical and non-technical stakeholders.

  • Risk Mitigation: A primary value proposition of an architect is identifying and mitigating technical risks early in the design process.
  • Simplifying Complexity: Architects should strive for simple, understandable architectures. Over-engineering often leads to maintainability issues.
  • Visualization Techniques: Tools like the "Phantom Sketch Artist" method can be employed to visualize and clarify unclear requirements and system behaviors.
  • Bridging the Gap: The "Architect Elevator" metaphor highlights the need to connect low-level technical details with high-level business strategy.
  • Technical Disagreement Resolution: Architects facilitate constructive technical discussions, aiming for consensus rather than imposing solutions.
  • Maintaining Technical Acumen: While moving into architecture, it's crucial to stay technically grounded. This can involve deep dives, code reviews, and hands-on problem-solving.

Case Study: Scaling Data at Meta

Managing data at massive scale involves specific architectural patterns:
* Infrastructure Components: Data storage and processing at scale rely heavily on distributed systems and data warehouses.
* Schematization: Meta historically leveraged bespoke schematization and practices to understand and manage data across its vast ecosystem.


2. Database Fundamentals & Administration

Understanding where data resides and how it is managed is crucial for both software development and systems administration.

  • Relational Databases: Relational databases are fundamentally designed to store and retrieve data efficiently.
  • Importing & Exporting: Exporting and importing databases are common tasks shared by software developers and system administrators alike.
  • User Credentials & Permissions (MySQL/MariaDB):
    • User credentials and permissions are stored within a dedicated system database named mysql.
    • These credentials and permissions are not stored within individual application databases, making it critical to manage the system database separately during migrations.

3. Database Performance & Consistency

Different database engines come with varying capabilities and performance characteristics that developers must navigate.

  • Consistency Guarantees: Database consistency guarantees vary significantly between different products. Developers must not assume uniform consistency models across different relational or non-relational databases.
  • Sort Order Optimization: Databases perform significantly better when data is stored and accessed using matching sort orders. (For example, matching indexes to query sort orders is a key optimization pattern in systems like PostgreSQL).

Case Study: Horizontal Scaling at YouTube (MySQL & Vitess)

When scaling relational databases to support billions of users, physical hardware limitations, connection overhead, and monolithic table structures inevitably become critical bottlenecks. YouTube resolved these challenges at scale by creating Vitess, an open-source database clustering middleware system for MySQL.

  • The Problem with Native MySQL at Scale:
    • Connection Limits: MySQL uses a thread-per-connection model. A massive influx of concurrent application connections rapidly exhausts memory and degrades performance.
    • Sharding Complexity: Natively, MySQL does not support transparent horizontal sharding, forcing developers to write complex application logic to route queries to the correct database shards.
  • Key Architectural Components of Vitess:
    • VTGate (SQL Proxy): A lightweight proxy server that routes application queries to the appropriate database shards. It parses SQL queries, orchestrates distributed transactions, and ensures the application layer remains agnostic of the underlying sharding topology.
    • VTTablet (Connection Manager): Runs alongside each MySQL instance to manage performance. It acts as an aggressive connection pooler, dynamically managing active connections to prevent MySQL from running out of resources.
    • Transparent Sharding: Enables seamless splitting (and re-sharding) of MySQL tables across multiple physical instances without requiring modifications to the core application code.

Source Tags

Research Conversations

  • None promoted yet

Synthesis

Last run Jun 3, 2026

Research

Research this page →

Opens a new conversation pre-loaded with 20 bookmarks.