Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is a microservice in software architecture?
A microservice is a small, independent service that performs a specific function within a larger application. It communicates with other microservices through simple interfaces like APIs.
Click to reveal answer
beginner
Why do we use microservices instead of one big application?
Microservices allow teams to build, deploy, and scale parts of an application independently. This makes the system easier to manage, update, and grow over time.
Click to reveal answer
intermediate
In a microservice architecture diagram, what does an API Gateway do?
An API Gateway acts like a front door that routes client requests to the right microservice. It can also handle security, load balancing, and request transformations.
Click to reveal answer
intermediate
What is the role of a service registry in microservices?
A service registry keeps track of all running microservices and their locations. This helps services find and communicate with each other dynamically.
Click to reveal answer
beginner
Name two common communication methods between microservices.
Microservices commonly communicate using synchronous HTTP/REST calls or asynchronous messaging with queues or event streams.
Click to reveal answer
What is the main advantage of using microservices?
AAvoiding network communication
BBuilding one large, monolithic application
CUsing a single database for all services
DIndependent deployment and scaling of components
✗ Incorrect
Microservices allow independent deployment and scaling, unlike monolithic apps.
In a microservice architecture, what does the API Gateway do?
AStores all application data
BRoutes client requests to appropriate microservices
CRuns the user interface
DManages database transactions
✗ Incorrect
The API Gateway routes requests and can handle security and load balancing.
Which component helps microservices discover each other?
ADatabase
BLoad Balancer
CService Registry
DAPI Gateway
✗ Incorrect
The Service Registry tracks running services and their locations.
Which communication method is asynchronous in microservices?
AMessage queues or event streams
BHTTP REST calls
CDirect database access
DSynchronous API calls
✗ Incorrect
Message queues allow asynchronous communication between services.
What is a key characteristic of a microservice?
ASmall and focused on a single function
BLarge and handles many functions
CTightly coupled with other services
DRuns only on a single server
✗ Incorrect
Microservices are small and focused on one function for easier management.
Describe the main components and flow in a simple microservice architecture diagram.
Think of how a customer orders food through a waiter who directs the order to the kitchen stations.
You got /5 concepts.
Explain why microservices improve scalability and maintenance compared to monolithic applications.
Compare fixing one room’s light in a house versus rewiring the entire house at once.
You got /5 concepts.
Practice
(1/5)
1. What is the main role of an API Gateway in a microservice architecture?
easy
A. It stores all the data for the microservices.
B. It routes client requests to the correct microservice.
C. It runs the user interface of the application.
D. It replaces all microservices with a single service.
Solution
Step 1: Understand the API Gateway function
The API Gateway acts as a single entry point that directs client requests to the appropriate microservice.
Step 2: Compare other options
Storing data is done by individual services, not the gateway. The UI runs separately, and the gateway does not replace microservices.
Final Answer:
It routes client requests to the correct microservice. -> Option B
Quick Check:
API Gateway = Request Router [OK]
Hint: API Gateway directs requests, it does not store data [OK]
Common Mistakes:
Thinking API Gateway stores data
Confusing API Gateway with UI component
Assuming API Gateway replaces microservices
2. Which of the following correctly shows a microservice owning its own data?
easy
A. Multiple microservices share one database directly.
B. Microservices do not use databases at all.
C. Each microservice has its own separate database.
D. All microservices write to a single shared file.
Solution
Step 1: Recall microservice data ownership principle
Each microservice should own and manage its own database to avoid tight coupling.
Step 2: Evaluate options
Sharing one database or file breaks independence. Not using databases is unrealistic for data needs.
Final Answer:
Each microservice has its own separate database. -> Option C
Quick Check:
Microservice = Own Data Store [OK]
Hint: Microservices keep data separate, no shared DB [OK]
Common Mistakes:
Assuming all services share one database
Thinking microservices don't need databases
Using shared files for data storage
3. Given this simple microservice setup: Client -> API Gateway -> Service A -> Service B What happens if Service B is down when Client sends a request?
medium
A. The API Gateway automatically retries Service B until it responds.
B. The API Gateway routes the request to Service B's backup automatically.
C. The client request is handled fully by Service A without contacting Service B.
D. Service A will fail to complete the request and return an error to the client.
Solution
Step 1: Trace request flow with Service B down
The client request goes through API Gateway to Service A, which calls Service B. If Service B is down, Service A cannot complete its task.
Step 2: Understand failure impact
Without Service B responding, Service A returns an error back through the API Gateway to the client.
Final Answer:
Service A will fail to complete the request and return an error to the client. -> Option D
Quick Check:
Down service causes error response [OK]
Hint: Down service causes error, no automatic retry [OK]
Common Mistakes:
Assuming automatic retries by API Gateway
Thinking Service A can handle request alone
Believing API Gateway has backup routing
4. In this microservice diagram, the API Gateway calls Service A and Service B directly. But Service A calls Service B internally and Service B calls Service A internally. What is the main problem with this design?
medium
A. It creates a circular dependency between services.
B. API Gateway should not call any services directly.
C. Services should share one database instead.
D. Service A should call Service B, not the other way.
Solution
Step 1: Identify service call relationships
API Gateway calls both Service A and Service B, and Service A calls Service B and Service B calls Service A, forming a loop.
Step 2: Understand circular dependency issues
Circular dependencies cause tight coupling and can lead to failures or deadlocks.
Final Answer:
It creates a circular dependency between services. -> Option A
Quick Check:
Circular calls = Bad design [OK]
Hint: Avoid circular calls between microservices [OK]
Common Mistakes:
Thinking API Gateway shouldn't call services
Believing shared database fixes call loops
Assuming call direction must be reversed
5. You want to design a microservice architecture for an online store with these needs: - User service manages user profiles - Product service manages product info - Order service creates orders and needs user and product data
Which architecture diagram best fits these requirements?
hard
A. Client -> API Gateway -> User Service, Product Service, Order Service; Order Service calls User and Product Services internally.
B. Client -> API Gateway -> Order Service only; Order Service manages users and products internally.
C. Client -> API Gateway -> User Service and Product Service only; Order Service is part of API Gateway.
D. Client -> API Gateway -> User Service; Product Service calls Order Service; Order Service calls User Service.
Solution
Step 1: Analyze service responsibilities
User and Product services manage their own data. Order service needs to create orders using data from both.
Step 2: Check communication flow
Order service calling User and Product services internally keeps responsibilities clear and allows data ownership.
Step 3: Evaluate options
Client -> API Gateway -> User Service, Product Service, Order Service; Order Service calls User and Product Services internally. matches this design. Others either merge services incorrectly or create wrong call flows.
Final Answer:
Client -> API Gateway -> User Service, Product Service, Order Service; Order Service calls User and Product Services internally. -> Option A
Quick Check:
Order service calls needed services [OK]
Hint: Order service calls user and product services internally [OK]