Monolithic architectures package all application functionality into a single deployable unit, which is simpler to develop and deploy initially but harder to scale individual components and ties the entire system to a single codebase and deployment. Microservices decompose the application into small, independently deployable services that can scale, deploy, and use different technologies independently, with better fault isolation as a key benefit. The trade-off is increased operational complexity in networking, observability, and data consistency.
In a microservices environment, instances come and go dynamically, so services need a way to locate each other. Service discovery provides this mechanism. In client-side discovery, the client queries a service registry such as Netflix Eureka, Consul, etcd, or ZooKeeper, and selects an instance directly. In server-side discovery, the client sends a request to a load balancer or router (such as AWS ALB or Kubernetes kube-proxy), which queries the registry on the client's behalf.
An API gateway acts as a single entry point for all client requests to backend microservices. It handles request routing, authentication and authorization, rate limiting and throttling, request and response transformation, SSL termination, caching, logging, and monitoring. By centralizing these cross-cutting concerns, an API gateway simplifies client interactions. Kong, AWS API Gateway, NGINX, and Apigee are popular implementations.
A reverse proxy similarly sits in front of backend servers and forwards client requests to them, but its focus is on behalf of servers rather than clients, since a forward proxy acts on behalf of clients. Reverse proxies provide security by hiding backend server IPs, perform SSL termination, distribute traffic as a load balancer, serve cached responses, and compress payloads. NGINX, HAProxy, and Traefik are common examples. Underpinning all of this is DNS, the Domain Name System that translates human-readable domain names into IP addresses. Resolution flows from the browser's local cache to a recursive resolver, then through root nameservers, TLD nameservers, and finally authoritative nameservers, with results cached according to their TTL. Common record types include A (IPv4), AAAA (IPv6), CNAME (alias), MX (mail), NS (nameserver), and TXT.