02 Client Server Architecture - gannurohith/devops-interview-wiki GitHub Wiki

📁 02 - Client-Server Architecture (Basic to Intermediate Q&A)

  1. What is Client-Server Architecture? A model where clients request services and servers provide them, typically over a network.

  2. What are the main components of this architecture?

    • Client: initiates requests
    • Server: processes and responds
    • Network: facilitates communication
  3. Can you give real-world examples of client-server systems?

    • Web browser (client) ↔ Web server (e.g., Apache, Nginx)
    • Mobile app ↔ Backend API
  4. How does HTTP fit into client-server architecture? HTTP is the protocol enabling client-server communication over the web.

  5. What is a stateless server? A server that doesn't retain session data between requests. Each request must contain all necessary info.

  6. How is state managed in stateless systems? Via tokens (JWTs), cookies, or external stores like Redis.

  7. What’s the difference between client-server and peer-to-peer architecture?

    • Client-server: centralized control.
    • Peer-to-peer: equal nodes, no central authority.
  8. What are some benefits of client-server architecture?

    • Centralized management
    • Easier scaling and maintenance
    • Security policies can be enforced
  9. What are common challenges in this model?

    • Server bottlenecks
    • Single point of failure
    • Latency over networks
  10. How do load balancers support this architecture? Distribute requests among multiple servers to improve performance and availability.

  11. How does DNS fit into client-server communication? Resolves human-readable names (e.g., google.com) to IP addresses needed to connect to servers.

  12. What is an API in this context? An interface through which clients interact with server logic (e.g., REST or GraphQL APIs).

  13. What are some client-side technologies?

  • HTML, CSS, JavaScript
  • React, Angular, Flutter
  1. What are some server-side technologies?
  • Node.js, Python, Java, PHP
  • Databases: MySQL, MongoDB
  1. What is latency and how does it impact this model? Latency is delay in communication, which can cause slowness or timeouts.

  2. How do retries and timeouts work between client and server? Clients often retry failed requests; timeout defines how long they wait before giving up.

  3. How is data secured between client and server? Use of HTTPS (TLS encryption), token-based auth (OAuth2, JWT).

  4. What is a reverse proxy? A server that sits in front of backend servers, forwarding client requests and possibly caching responses.

  5. Can clients talk to multiple servers at once? Yes, using multithreading, async calls, or service meshes.

  6. How are microservices deployed in client-server models? Each service acts as a mini-server, often exposed via API Gateway.

  7. What is a 3-tier architecture?

  • Presentation (client)
  • Logic (application server)
  • Data (database server)
  1. How are sessions handled in client-server systems? Through cookies, tokens, or session IDs stored on client or server.

  2. What’s the role of a firewall in this model? Filters network traffic to protect servers from unauthorized access.

  3. How does caching work between client and server? Data stored temporarily (e.g., in browser or CDN) to reduce repeat server hits.

  4. What is a WebSocket and how does it enhance this model? A protocol enabling real-time, bi-directional communication between client and server.


02. Client-Server Architecture (Q&A)

  1. Explain the differences between monolithic, 3-tier, and microservices architectures. Answer: Monolithic apps have all components in one package; 3-tier apps separate frontend, backend, and database layers; microservices break functionality into independent, small services that communicate via APIs, providing scalability and fault isolation.

  2. What are the components of a client-server model in modern web architecture? Answer: Clients (browsers, mobile apps), servers (web servers, app servers), APIs, databases, load balancers, and sometimes CDNs and reverse proxies.

  3. A client is experiencing high latency. How do you troubleshoot? Answer: Check client logs, server performance, network latency using ping, traceroute, browser dev tools, load balancer metrics, and server-side metrics via CloudWatch or similar tools.

  4. How would you handle session persistence in a load-balanced architecture? Answer: Use sticky sessions or external session stores like Redis to persist session data across servers. Best practice is stateless apps with shared storage.

  5. Describe the role of an API gateway in client-server communication. Answer: API Gateway centralizes API requests, handles routing, rate limiting, authentication, caching, and transforms requests/responses across microservices.

  6. How does DNS resolution impact client-server interactions? Answer: DNS resolves domain names to IPs. Slow or misconfigured DNS can delay or block client access. TTLs affect caching and failover behavior.

  7. What is the difference between synchronous and asynchronous communication? Answer: Synchronous requires immediate response (e.g., HTTP), while asynchronous allows decoupling via queues (e.g., Kafka, SQS), improving resiliency.

  8. How can you secure data in transit between client and server? Answer: Use HTTPS (TLS 1.2+), validate certificates, enable HSTS, disable weak ciphers, and optionally implement mutual TLS (mTLS).

  9. What’s the difference between REST and gRPC in client-server APIs? Answer: REST uses JSON over HTTP; gRPC uses Protobuf over HTTP/2. gRPC is faster, supports bi-directional streaming, and is ideal for microservices.

  10. What are WebSockets, and when would you use them? Answer: WebSockets offer full-duplex communication between client and server. Use them for real-time apps (e.g., chat, live dashboards).

  11. Describe a real-world incident involving server overload. How was it resolved? Answer: Example: sudden traffic spike from campaign; resolution involved autoscaling, adding CDN caching, and queueing low-priority tasks.

  12. What is TCP slow start? How can it affect latency? Answer: TCP slow start limits initial data to prevent congestion, gradually increases. High latency on new connections until ramp-up.

  13. How does TLS termination work on a load balancer? Answer: The load balancer decrypts traffic (terminates TLS), then forwards plain HTTP to internal services, reducing CPU load on apps.

  14. In microservices, how do services discover each other? Answer: Via service discovery tools like Consul, Eureka, DNS-based discovery, or built-in cloud service registries (e.g., AWS Cloud Map).

  15. Describe common failure scenarios in a distributed client-server architecture. Answer: Timeouts, network partitioning, resource saturation, DNS resolution failure, misconfigured SSL, rate limiting issues.

  16. How do you implement API versioning to avoid breaking clients? Answer: Use URI-based versioning (/v1/api/), headers (Accept-Version), or query parameters. Maintain old versions for backward compatibility.

  17. What is a reverse proxy? Give an example using Nginx. Answer: Reverse proxy forwards client requests to backend servers. Example:

location /api/ {
  proxy_pass http://backend:8080;
}
  1. Describe 3 strategies for rate limiting API traffic. Answer: Token bucket, leaky bucket, and fixed window counters. Can be implemented in API gateways, proxies, or server middleware.

  2. How does caching affect client-server performance? Answer: Reduces backend load and latency. Types: browser cache, CDN, reverse proxies, and app-level caches (Redis, Memcached).

  3. Explain eventual consistency and where it applies. Answer: Data may not be immediately consistent across nodes (e.g., in distributed databases like DynamoDB), but will converge over time.

  4. What is a circuit breaker pattern in client-server apps? Answer: Prevents continual retrying to a failed service. Opens circuit on repeated failures, allows recovery checks before resuming traffic.

  5. What is a service mesh and how does it help? Answer: Manages service-to-service traffic, with features like retries, observability, TLS, and load balancing. Example: Istio, Linkerd.

  6. How would you monitor client-side errors effectively? Answer: Use tools like Sentry, Raygun, or browser logging with ELK/CloudWatch. Track JS exceptions, failed API calls, user behavior.

  7. What is the difference between a proxy and a gateway? Answer: Proxy forwards traffic without inspection or policy. Gateway can transform, authenticate, authorize, and monitor requests.

  8. What is MTLS and how does it differ from TLS? Answer: TLS authenticates server only. mTLS authenticates both server and client using certificates. Ideal for internal microservice communication.