From monoliths to microservices

Microservices apply the UNIX philosophy (“Do one thing and do it well”) and the Single-Responsibility Principle (SRP)—where each module is responsible to one, and only one, actor (a group of stakeholders or users)—to full applications. Rather than compiling every feature into one binary or VM, a microservices architecture structures an application as a collection of loosely coupled, independently deployable services, each handling one business task and usually managing its own database.

Historical context from the source: Amazon’s 1998 Distributed Computing Manifesto outlined encapsulating data inside services with event-driven workflows (an early form of Service-Oriented Architecture, SOA); the term microservices appeared at a workshop near Venice in May 2011 and was popularized by Lewis and Fowler in 2014.

Concrete example: Online Boutique and selective scaling

Google Cloud’s Online Boutique (microservices-demo) demonstrates how one storefront splits into separate services, each typically running in its own container:

  • External requests enter over HTTP (Internet or Load Generator -> Frontend).
  • Frontend delegates to specialized backend services: ProductCatalogService, RecommendationService, CartService (backed by a Redis cache), AdService, CurrencyService, ShippingService, and CheckoutService.
  • CheckoutService in turn coordinates PaymentService, ShippingService, EmailService, CurrencyService, ProductCatalogService, and CartService.

This separation changes how scaling works (Martin Fowler’s comparison): a monolith replicates the entire application block onto every server, whereas microservices distribute individual services across servers and replicate only the heavily loaded ones (for example, several replicas of ProductCatalogService alongside one instance of EmailService).

Monolithic vs. microservices architecture

CharacteristicMicroservices architectureMonolithic architecture
Unit designLoosely coupled services; each supports one business taskSingle unit designed, developed, and deployed together
Functionality reusePublic or internal APIs expose capabilities to any client or appLimited reuse across separate applications
Internal communicationNetwork-based: request-response (REST/HTTP, gRPC) or async pub/sub (Kafka)In-process procedure/function calls with no network limit
Tech flexibilityEach service can choose the best language and framework for its taskUsually written in one language and framework
Data managementDecentralized: each service may own its databaseCentralized: shared database(s) for the whole application
DeploymentIndependent deployment per serviceAny small change requires redeploying and restarting the whole app
MaintainabilityFocused, smaller services simplify local maintenanceComplexity grows as overall scope expands
ResiliencyDistributed; remaining replicas keep serving if one instance failsFailure in one component can bring down the entire application
ScalabilityScale each service independentlyMust scale the entire application together

Embedded libraries vs. microservices

Both libraries and microservices enable code reuse, so learners frequently confuse when each applies:

PropertyEmbedded library (traditional)Microservice (modern)
Nature of componentCode only (e.g., logging, JSON marshalling/unmarshalling, auth library)Live running component: code + data
Data ownershipEvery calling app embeds the code and maintains its own database (e.g., separate Users DBs and password-reset flows)One shared service holds both the logic and the single authoritative Users DB
IntegrationLinked into the app; called via local functionsInvoked over the network through an API
UpdatingMust recompile and redeploy every application that embeds the libraryUpdate the microservice without recompiling callers, provided the API contract stays compatible

Because projects can compose already-running services (such as a company-wide authentication service), delivery times shrink dramatically.

Discovery problem: knowing which services exist

Unlike top-down, architect-designed SOA, microservices are developer-driven and evolutionary (“clone and evolve, the best will survive”). When an application relies on hundreds of services and an overall “architecture blueprint” no longer exists, meetings, calls, and emails cannot keep teams informed about who owns each service, what data it holds, or what API it exposes.

Organizations solve this with a software catalog / developer portal—such as Backstage (created at Spotify and donated to the CNCF)—so services are self-documented and discoverable without human coordination.

Common confusions

  • Modular code in one deployable is not microservices: Dividing code into clean packages inside one shared runtime still yields a monolith unless services run and deploy independently.
  • Libraries do not eliminate data duplication: Sharing an authentication library still forces every application to store and manage its own copy of user credentials.

Retrieval

  1. Two applications, A and B, both need user login. Compare importing an auth library versus calling an Authentication microservice when user passwords change or a bug fix is released.
    With an embedded library, A and B each keep separate user databases (requiring separate updates/resets) and both must be recompiled to adopt a library patch. With a microservice, both share one live service + Users DB over an API, and the service can be patched without recompiling A or B as long as the API remains compatible.
  2. Why does a large microservice organization need a software catalog like Backstage even if every service has a clean API?
    Because developer-driven architectures evolve without a central blueprint, teams cannot rely on human meetings to track hundreds of services; a catalog documents ownership, purpose, data, and APIs for self-service reuse.

Source: Lecture 10 - Microservices and Containers Orchestration, PDF pages 6–15.