20 System Design Concepts You Must Know - Final Part

ByteByteGoAbout 4 min readJul 18, 2025Watch original
THE SUMMARYAI-generated

Key Concepts

Microservices, Authentication & Authorization, Service Discovery, API Gateway, Message Queues, WebSockets, Scalability, Maintainability, Reliability, System Architecture.

Microservices

  • Definition: An architectural approach structuring an application as a collection of small, independent services communicating via well-defined APIs.
  • Functionality: Breaking down large applications into smaller, focused services (e.g., user accounts, product catalog, shopping cart, payment processing, order fulfillment in a shopping application). Each service handles a specific business capability.
  • Advantages:
    • Flexibility: Independent teams can work on different services without coordination overhead.
    • Scalability: Each service can use the technology stack best suited for its needs and scale independently based on individual requirements.
  • Disadvantages:
    • Complexity: Function calls become network requests, which can fail, time out, or return unexpected results.
    • Requires sophisticated monitoring, logging, and error handling.
  • Principle: Microservices are suitable when complexity justifies the coordination overhead. Not ideal for simple applications or small teams.

Authentication and Authorization

  • Definition: Security mechanisms verifying user identity (authentication) and controlling access to system resources (authorization).
  • Functionality: Answering the questions: "Who is this user?" and "What are they allowed to do?".
  • Authentication:
    • Modern systems use token-based authentication.
    • Users receive a token upon login, proving their identity for subsequent requests.
  • Authorization:
    • Role-based systems assign permissions to roles (e.g., viewer, editor) and then assign users to roles.
    • Attribute-based policies consider user properties, resource characteristics, and contextual information.
  • Challenge: Maintaining consistent security across distributed components.
  • Solutions: Passing security tokens between systems and implementing centralized policy engines for consistent authorization decisions.

Service Discovery

  • Definition: Enables system components to locate and communicate with each other in dynamic environments.
  • Problem: In cloud deployments, service network addresses change constantly as systems scale.
  • Functionality:
    • Maintains a registry of available services and their current locations.
    • Services register themselves upon startup.
    • Components query the registry to find service addresses.
  • Implementations: DNS-based discovery, dedicated registry services, and integrated solutions from container orchestration platforms.
  • Challenges: Handling failures gracefully (registry unavailability, service crashes).

API Gateway

  • Definition: A single entry point for client requests, handling routing, security, and cross-cutting concerns.
  • Problem: Without a gateway, clients need to know about every backend service, creating tight coupling.
  • Functionality:
    • Presents a unified interface to clients.
    • Routes requests to appropriate backend services.
    • Aggregates responses from multiple services.
    • Transforms data formats.
    • Manages authentication and authorization.
  • Example: A mobile app request might be authenticated, profile fetched from one service, activity from another, and combined into a single response.
  • Operational Features: Automatic retries, circuit breakers, request/response caching, and detail logging.
  • Trade-off: The gateway becomes a critical component requiring high availability and performance.

Message Queues

  • Definition: Enables asynchronous communication between system components.
  • Functionality:
    • Components exchange messages without requiring simultaneous availability.
    • One component sends a message to a queue, and others subscribe to it.
    • Decouples components in time.
  • Delivery Guarantees:
    • At most once: Messages are never duplicated but might be lost.
    • At least once: Messages won't be lost but might be delivered multiple times.
    • Exactly once: Each message is processed exactly once (most complex).
  • Trade-off: Increased complexity in handling failures and maintaining data consistency.

WebSockets

  • Definition: Enables real-time bidirectional communication between clients and servers over a persistent connection.
  • Problem: Traditional HTTP requires clients to constantly poll the server for updates.
  • Functionality:
    • Upgrades an HTTP connection to a persistent bidirectional channel.
    • Both client and server can send messages independently.
    • Server can push updates to clients immediately.
  • Advantages:
    • Reduces latency for real-time applications.
    • Reduces server load by eliminating constant polling.
  • Disadvantages:
    • Websocket connections are stateful and tied to specific server instances.
    • Network interruptions, proxy servers, and firewalls can interfere with connections.
  • Requirements: Robust reconnection logic, heartbeat mechanisms, and fallback strategies.

Conclusion

The video covered six fundamental system architecture patterns: Microservices, Authentication & Authorization, Service Discovery, API Gateway, Message Queues, and WebSockets. These patterns are essential for building scalable, maintainable, and reliable systems. The key is to choose the right combination of patterns based on specific requirements. Not every system needs all components, but understanding when and how to apply each one is crucial.

AI summaries can miss context or contain errors. Check important details against the original video.

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.