In microservices architecture, why do we aim for high cohesion within each service?
Think about how grouping related tasks affects service clarity and updates.
High cohesion means each microservice focuses on a single responsibility. This makes it easier to maintain, test, and scale independently.
Which of the following microservice designs shows the highest cohesion?
Look for the service that groups closely related responsibilities.
Service A focuses solely on user profiles and preferences, which are closely related tasks, showing high cohesion.
How does high cohesion in microservices affect the ability to scale the system?
Think about how focused responsibilities affect resource allocation.
High cohesion means each service does one job, so you can scale only the services that need more resources, saving costs.
What is a potential downside of enforcing very high cohesion in microservices?
Consider what happens if you split responsibilities too finely.
Very high cohesion can create many tiny services, which makes deployment, monitoring, and coordination more complex.
You need to design a microservice for an e-commerce platform that handles product inventory. Which set of responsibilities best ensures high cohesion?
Focus on grouping tasks that relate directly to inventory management.
Option A groups all inventory-related tasks, ensuring the service has a clear, focused responsibility.