Friday, 28 February 2025

[Architecture] System Design goals

 

System Design goals

In future, System should handle the defined non-functional requirements.

  • Scalability: System can handle increased load without performance degrade
  • Performance: Optimized response time, Resource utilization
  • Reliability: Fault-tolerant, Data consistency, minimize failures and recover quickly
  • Availability: Accessible and operational with min downtime
  • Security: Protect resources/data from unauthorized access & cyber threats
  • Maintainability: Easy debug, updates or feature addition
  • Flexible & Extensibility: Modification & enhancements without major changes
  • Cost efficiency: Balancing performance & reliability while optimizing infra costs

 

Scalability

  • Vertical scaling (Scale Up): increase RAM/CPU
  • Horizontal scaling (Scale Out): Add more machines to dist load
    • e.g. Adding more web servers behind a LB
    • Tools: K8S (Initializing Pod instead of whole VM), AWS Autoscaling, LB – Nginx, HA Proxy
  • Elastic scaling (Serverless): Dynamically adjusting resources based on demand
    • Don’t care about VMs/servers, Cloud provider manages on our behalf
    • Tools: AWS Lambda, K8S horizontal Pod Auto-scaler

 

Best practices:

  • Use MS Archi to scale individually services independently
  • Implement Caching (Redis, Memcached) to reduce DB load
  • Optimize DB sharding to distribute
  • Use CDNs (Content Delivery Networks) e.g. CloudFare  / AWS CloudFront / Cloud CDN for faster content delivery – heavy text, images, videos etc.

 

Performance & Efficiency

  • Use indexing & Caching
    • Pagination, PageRank algo – pre-rank web pages
    • Dist caching for Redis/Memcached to store frequent search queries
  • LB & Distributed computing: Dist requests across multiple servers
    • HW LB: F5 / Big IP, Citrix ADC
    • SW LB: NGnix, HA Proxy

 

    • Network / Layer 4 LB : operate at transport layer (TCP/UDP) – based on IP, e.g. Linux virtual servers (LVS)
    • Network / Layer 7 LB : operate at application layer– NGnix, HA Proxy, Makes decision based on contents (URL, cookies, headers)

 

    • Cloud based LB: offered by cloud providers, e.g. AWS Elastic LB
    • DNS based LB: Uses DNS to dist traffic across multiple endpoints

 

  • Optimized DS&Algo: Optimize code, index in DB, MapReduce / Hive
  • HW optimization: High perf TPUs, High speed SSDs and Low latency networks

 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.