Look at a basic microservice architecture diagram with these components: API Gateway, User Service, Order Service, Database, and Message Queue.
Which component handles client requests first?
Think about which part acts as the entry point for all client requests.
The API Gateway is the first component that receives client requests and routes them to the appropriate microservice.
You have a microservice that handles user profiles. Traffic is increasing rapidly. Which approach best supports scaling this microservice?
Think about horizontal scaling and distributing load.
Deploying multiple instances behind a load balancer allows the service to handle more requests by distributing traffic.
In a microservice architecture, what is a key tradeoff when choosing asynchronous messaging over synchronous HTTP calls?
Consider how asynchronous communication affects system design and data handling.
Asynchronous messaging allows services to continue working if others are slow or down, improving resilience, but it makes keeping data consistent harder.
What is the main purpose of a service discovery component in a microservice architecture?
Think about how services know where other services are located.
Service discovery helps services locate each otherβs network addresses dynamically, enabling communication without hardcoding locations.
You design a microservice expected to handle 10,000 requests per second. Each request takes 50ms CPU time on average. How many instances are needed to handle the load without queuing?
Calculate total CPU time per second and divide by CPU time per instance.
Each request takes 0.05 seconds CPU time. 10,000 requests per second means 500 CPU-seconds needed per second. One instance (assuming 1 CPU core) can handle 1 CPU-second per second. So, 500 instances are needed to handle the load without queuing.