What are microservices?

Microservices are an architectural style where an application is built as a collection of small, independently deployable services, each responsible for a specific business capability.

Key Points: • Each microservice owns a well-defined, focused piece of functionality rather than being part of one large shared codebase. • Services can be developed, deployed, and scaled independently of each other, without requiring the whole application to be redeployed for a single change. • Services typically communicate over lightweight protocols like HTTP/REST or asynchronous messaging, rather than in-process method calls. • Each service can, in principle, use its own technology stack and its own database, chosen to fit that service's specific needs. • This independence makes the system more flexible to change and more resilient, since a failure in one service doesn't necessarily bring down the entire application.

Example: An online store built as microservices might have separate services for User Accounts, Product Catalog, Shopping Cart, and Payments, each deployed and scaled on its own, communicating over REST APIs to complete a customer's purchase.

Interview Tip: A concise interview answer is:

"Microservices are an architectural style that structures an application as a set of small, independently deployable services, each owning a specific business capability and communicating over the network, typically via REST or messaging. It's the opposite of a monolith, where everything is built and deployed as one large unit."