Microservices architecture emerged to overcome the limitations of traditional monolithic architecture. A monolith consists of one huge codebase, which makes deployment and scaling difficult, and a failure in one part affects the entire system. Microservices, by contrast, solve these problems because each service operates independently.
The core principles include the Single Responsibility principle, Loose Coupling, and High Cohesion. Each service has its own database (Database per Service) and does not access other services' data directly, communicating only through APIs.
Inter-service communication is divided into synchronous and asynchronous approaches. The synchronous approach uses REST API or gRPC, while the asynchronous approach communicates in an event-driven manner through message queues (RabbitMQ, Kafka). The asynchronous approach can reduce coupling between services further.
API Gateway acts as a single entry point between clients and microservices. It handles cross-cutting concerns such as authentication, routing, load balancing, and rate limiting. Kong, AWS API Gateway, and Netflix Zuul are representative examples.
Service Mesh is an infrastructure layer that manages communication between services. Tools such as Istio and Linkerd provide traffic management, security, and observability. A sidecar proxy is placed alongside each service to separate network logic from the application code.