System Design
On September 3, 2018 in notes • 2 minutes read
An algorithm for solving system design interviews:
- Requirements
- Math
- Data in (Concurrency) X Data out
- Latency x Throughput
- Main bottlenecks
- Availability
- Performance (Response time, Scalability, CPU / IO / Network bound applications)
- Confidentiality (Encryption)
- High level design
- Evaluate use cases: what is the flow for each of them?
- This usually results in, at a minimum:
- Application layer & responsibilities
- Database layer & responsibilities
- Detailed design
- Start small & grow big
- Profiling: Estimate & test load for every use case and identify bottle necks
- Requests per second resulting in:
- Write per second (Where? What?)
- Read per second (Where? What?)
- Handy reference: 2.5 million seconds per month
- Requests per second resulting in:
- Horizontal X Vertical Scaling - DNS Server: Resource allocation
- Resolves the text URL for a particular web resource to the TCP-IP address of the system or service: Must be quick
- Directs to either:
- Proxies / Firewalls
- CDNs: Geographically distributed for static assets: templates , themes , images, etc.
- Cloud Backend: Web & App functionalities - Load Balancing: Horizontal scaling & Redundancy
- Software X Hardware
- Zero Uptime & Increased Performances:
- Responsibilities:
- Health checks
- Load distribution algorithms
- Challenge: Session Management
- Sticky sessions X External storage - Web application layer: Serves dynamic content & renders HTML
- Multiple instances serve independent requests
- Off-Line Processing: Reduces latency and/or handles batch processing
- Message Queues: Queue work & process in parallel
- Scheduling System Tasks: Perform recurring tasks offline
- Specialized infrastructure: Map-Reduce for big data - Content Performances: Improves use of resources
- Caching
- Where?
- Which layer? Application X Dedicated X Database
- In memory for vertical scaling?
- Writethrough cache: Write to cache and then continously push to DB
- Challenge: Concurrency & Cache Invalidation at App Layer - Manageability: Platform & Management Layer
- Where?
- Separates the DB and Web application: Scale the pieces independently.
- Independent API: Re-use layers for different purposes
- Includes:
- Automation & Cost Improvement:
- Just-in-time Infrastructure
- Reduces human interaction & errors
- Monitoring and Alerts
- Log files
- Automation & Cost Improvement:
- Development practices:
- Source control
- Multi-step deployment - Database Layer
- Type: Relational X Graph X Key-Value stores
- Availability: Master and Standby
- Performances:
- Master and Read Replicas
- Horizontal Scaling of Data Storage: Sharding for storing data on separate databases
- Per Table Indexes: Avoid searches in your data
- Data Loss: Backups
- Security
- Think of Confidentiality / Integrity / Availability
- Prevention: Lock out attackers
- Shared vs Dedicated Instances
- Access Control & Authentication:
- Active Directory
- Two factor authentication
- Firewalls (Security Groups) between layers of architecture
- Data & Traffic Encryption - Detection: Find anomalous behaviour
- Baselining
- DDoS mitigation - Reaction: Admins & System take appropriate measure to stop attack
- Alarms
- Honeypots
- Low Level
- Database Schema
- RESTful API
Related
Other Pages in the Notes Category
- December 26, 2021: On Aging
- December 18, 2021: Xbox Game Pass Space Hog
- July 06, 2021: No-nos
- July 06, 2021: Coaches' rules for life
- April 22, 2021: Barrels and Ammunitions
- April 10, 2021: Cocktail Class
- September 04, 2019: High Standards
- August 26, 2019: Business Strategy
- July 16, 2019: Organisational Culture
- June 22, 2019: Threat Modeling
- June 22, 2019: Test Driven Development
- June 22, 2019: Object Oriented Programming
- June 22, 2019: Load Balancing
- June 22, 2019: Introduction
- June 22, 2019: Highly Effective Managers
- June 22, 2019: Design Patterns
- June 10, 2019: Organisational Design
- January 06, 2019: Performance Management
- January 06, 2019: Decision Making
- January 06, 2019: Conflict Management
- October 11, 2018: Psychological Safety
- October 10, 2018: Radical Candor
- October 10, 2018: Objectives and Key Results
- September 16, 2018: Fluency
- September 15, 2018: Tactical and Strategic
- September 14, 2018: Precise Estimates
- September 14, 2018: Coaching
- September 13, 2018: Turkish
- September 11, 2018: Mindmapping STAR
- September 10, 2018: Design Thinking
- September 08, 2018: Undone Work
- September 04, 2018: Product Market Fit
- September 04, 2018: Idea to Launch
- September 04, 2018: Virtues
- September 03, 2018: SOLID
- September 03, 2018: CAP
- September 03, 2018: ACID