Skip to main content

19. Highload & Scalability

What is Load Balancing?​

Middle

Answer: Distributing network or application traffic across multiple servers to improve responsiveness and availability.


How to optimize a slow GET endpoint that retrieves many records?​

Senior

Answer:

  • Use pagination.
  • Use caching (Redis/Memcached).
  • Optimize database queries (indexing, select only needed columns).
  • Use Eager Loading to avoid the N+1 problem.

What is the CAP Theorem?​

Senior

Answer: In a distributed system, you can only provide two of the following three guarantees: Consistency, Availability, and Partition Tolerance.


What is Database Replication?​

Senior

Answer: Copying data from one database server (Master) to another (Slave) to improve reliability, fault tolerance, and performance.