System-Design by The Webspace
- System design refers to the process of defining the architecture, components, modules, interfaces, and data of a system to satisfy specified requirements.
- Understand the Problem: Identify the scope and objectives.
- Stakeholder Involvement: Gather input from stakeholders.
- Document Requirements: Clearly define functional and non-functional requirements.
- Prioritize Requirements: Determine critical features for MVP.
- Functional Requirements: Define specific behavior or functions (e.g., login, data retrieval).
- Non-Functional Requirements: Define system attributes like performance, scalability, and security.
- Frontend: User interfaces and experience.
- Backend: Servers, APIs, and databases.
- Database: Storage and retrieval of data.
- Networking: Communication between components.
- Requirements Analysis
- System Architecture
- Component Design
- Implementation
- Testing
- Deployment
- Maintenance
- The ability of a system to handle growth in workload efficiently.
- Horizontal Scaling: Adding more machines.
- Vertical Scaling: Upgrading existing machines.
| Feature | Horizontal Scaling | Vertical Scaling |
|---|---|---|
| Cost | Higher | Lower |
| Implementation | Complex | Simpler |
| Scalability Limit | High | Limited |
- Database Overload
- Network Latency
- CPU and Memory Constraints
- Single codebase.
- Pros: Simple to develop.
- Cons: Difficult to scale and maintain.
- Modular services.
- Pros: Scalable and maintainable.
- Cons: Complex to implement.
| Feature | Monolithic | Microservices |
|---|---|---|
| Scalability | Limited | High |
| Flexibility | Low | High |
- Systems respond to events asynchronously.
- Pay-as-you-go execution model.
- Focuses on the architecture and major components of a system.
- Ensures the system is operational and accessible.
- Guarantees data integrity across the system.
- Ensures the system operates correctly and recovers from failures.
- Consistency: Every read receives the latest write.
- Availability: Every request receives a response.
- Partition Tolerance: System functions despite network failures.
- Concurrency: Multiple tasks make progress simultaneously.
- Parallelism: Tasks execute simultaneously on different processors.
- Distributes traffic across servers to improve performance and reliability.
- Distributes data across nodes to ensure minimal redistribution during changes.
- Caches content closer to users to reduce latency.
- Latency: Time taken to process a request.
- Throughput: Number of requests processed in a given time.
- Improves performance by storing frequently accessed data.
- Manages APIs and facilitates communication between microservices.
- Enables asynchronous communication between components.
- HTTP, gRPC, WebSocket, etc.
- TCP/IP, DNS, Reverse Proxy, etc.
- Standard for visualizing system design.
- SQL: Structured data, complex queries.
- NoSQL: Flexible schema, high scalability.
- File Storage: Stores files in directories.
- Database Storage: Organized data in tables or collections.
- Copies data across multiple servers for reliability.
- Splits data across multiple servers for scalability.
- Block: High performance, low latency.
- Object: Scalability for unstructured data.
- File: Hierarchical structure.
- Organizes data to reduce redundancy.
- Optimizes read performance by adding redundancy.
- Focuses on implementation details.
- Encapsulation, Inheritance, Polymorphism, Abstraction.
- Hashmaps, Trees, Queues, Graphs, etc.
- Breaks down problems into objects and their interactions.
- Authentication: Verifies identity.
- Authorization: Grants permissions.
- Singleton, Factory, Observer, etc.
- Improve performance and readability.
- Tests individual components.
- Tests interactions between components.
- Automates testing and deployment processes.
- Breaks systems into independent modules.
- Encryption, Firewalls, Authentication, etc.
- URL Shortening Service
- Design Dropbox
- Design Twitter
- System Design Netflix
- Uber System Architecture
- Design BookMyShow
- Facebook Messenger
- WhatsApp Messenger
- Understand the requirements.
- Create a high-level design.
- Address scalability and reliability.
- Discuss trade-offs.
- Understand OOP principles.
- Focus on modularity.
- Practice design patterns.
- Write clean, optimized code.
- Review example designs.
- Scalability.
- Consistency.
- High Availability.
- Caching.
- Load Balancing.
- Understand the problem.
- Identify key objects.
- Define relationships.
- Use appropriate design patterns.
- Create UML diagrams.
@The WebSpace