Skip to content

Operating Services

Question: what does each service need in order to be deployed, configured, observed, secured, and tested, and which of these needs are solved once for all services?

Interviews usually touch this only briefly. It grows with the number of services: each new deployable unit repeats these needs. Most of the material lives in the engineering notes; this hub collects the options and points to them.

Forces

  • Number of services: each concern is paid once per service unless it is shared.
  • Speed and safety of change: frequent independent deployments need automation and progressive delivery.
  • Diagnosability: a request that crosses several services can fail in any of them.
  • Trust between services: each service must know who the original caller is and what that caller may do.

Deployment

PatternMechanismFits whenCosts
Multiple service instances per hostSeveral instances share a host.Efficient use of a few machines.Instances compete for resources; deployments interfere.
Service instance per host, per VM, or per containerEach instance gets its own host, virtual machine, or container.Isolation between instances; containers make this cheap.More units to manage; containers need an orchestrator.
Serverless deploymentThe platform runs code per request or event.Spiky or low traffic; no servers to manage.Cold starts, execution limits, platform lock-in.
Service deployment platformAn automated platform provides a service abstraction: deploy, scale, discover, roll out.Many services.Platform to adopt and operate.

Release techniques such as blue/green deployment, canary releases, feature flags, and parallel runs are in the deployment notes. Platform details are in Kubernetes, infrastructure as code, and GitOps; the platform and delivery notes collect them. The code deployment case designs such a system.

Cross-cutting concerns

PatternMechanismFits whenCosts
Microservice chassisA framework that handles configuration, logging, health checks, metrics, and tracing for each service.Services share a language and stack.One chassis per language; upgrades must reach every service.
Service templateA starter project with these concerns already implemented, copied to begin a new service.Starting many similar services.Copies drift apart after creation.
Externalized configurationConfiguration, such as database locations and credentials, comes from the environment or a configuration service rather than the code.Every service that runs in more than one environment.A configuration source to secure and keep available.

A service mesh moves some of these concerns out of the chassis into infrastructure, independent of language.

Externalized configuration is factor III of the Twelve-Factor App. For its rationale and the frameworks that followed it, see Twelve-Factor and its descendants.

Observability

  • Log aggregation: collect logs from every instance in one searchable place.
  • Application metrics: instrument operations to gather statistics such as rate, errors, and latency.
  • Distributed tracing: give each external request an identifier that travels between services, and record timed spans of the work done for it.
  • Exception tracking: report exceptions to a central service that groups them and notifies developers.
  • Health check API: an endpoint that reports whether the instance can serve requests. Load balancers and registries use it to route traffic (see service discovery).
  • Audit logging: record user actions for later review.
  • Log deployments and changes: record deployments and configuration changes so incidents can be matched to them.

Study backlog: there are no observability notes yet. Start with instrumenting distributed systems for operational visibility (AWS Builders’ Library) and Newman, chapter 10.

Security

Access token: the API gateway authenticates the caller and passes a token, such as a JWT, that carries the caller’s identity and roles. Each service uses the token to authorize the request without calling an identity service.

The original notes frame security as a trade-off between total safety and total convenience. They separate authentication (who is calling) from authorization (what the caller may do).

Password storage:

  • The problem: a fast hash such as SHA-256 lets an attacker who steals the table try billions of guesses per second on GPUs. Without a salt, precomputed tables, including rainbow tables, crack common passwords in bulk, and identical hashes reveal users who share a password.
  • The approach: give each password a unique random salt, stored next to the hash, and use a slow, memory-hard function. Argon2id is the first choice, then scrypt or bcrypt. Set the cost parameters from current OWASP guidance rather than fixed numbers in a note.
  • Additional measures: a pepper, a secret key held outside the database in a secrets manager, means a stolen table alone is not enough. Rehash at the next login when the parameters change.
  • Better still: avoid storing passwords. Delegate authentication to an identity provider over OpenID Connect, or use passkeys.

Study backlog: usability trade-offs; service-to-service authentication; secrets management (see the secrets section of the GitOps notes and the Twelve-Factor critique of environment variables). The security note in the engineering topics is still an empty placeholder. Sources named in the original notes: Newman’s book (chapter 11 in the second edition) and the interviewing.io system design guide.

Testing

  • Consumer-driven contract test: the team that consumes a service writes tests that the provider runs, so the provider learns when a change would break a consumer.
  • Consumer-side contract test: tests that check a client can communicate with the service it depends on.
  • Service component test: tests a service in isolation, with test doubles for the services it calls.

See the test strategy notes for the broader approach.

UI composition

Two patterns build one screen from parts owned by different teams:

  • Server-side page fragment composition: the server assembles HTML fragments produced by several capability-specific web applications.
  • Client-side UI composition: the client assembles UI components, each owned by a team.

No notes yet; see Newman, chapter 14.

Leads to

Seen in cases

  • Code deployment: a case about building the deployment system itself.
  • AI and RAG: the golden-path templates (observable RAG, deterministic agent, eval harness) are service templates. They choose copied scaffolding over a shared library and read configuration from the environment. Design pressure asks for observability by design, replayable runs, and gradual release of versioned prompts, models, indexes, and tool schemas.

Sources

Library sources

  • Richardson 2019, Microservices Patterns: With Examples in Java – chapters 9-12
  • Newman 2021, Building Microservices: Designing Fine-Grained Systems, Second Edition – chapters 8-11 and 14
  • Xu 2023, Password, Session, Cookie, Token, JWT, SSO, OAuth – Authentication Explained, parts 1 and 2 – on Password storage and access tokens

Further reading:

  • Nygard 2018, Release It! Design and Deploy Production-Ready Software, Second Edition – parts II-III
  • Beyer et al. 2016, Site Reliability Engineering: How Google Runs Production Systems