Tutorial 1: Deployment, Scaling, and Observability

Unit 7 · Distributed and cloud web systems

Objectives

A stateless web process does not require a particular server instance to remember a user's session. Externalize session and durable data so instances can be added or replaced. Configuration belongs outside the image or source code, and secrets must not be committed.

request_count{route="/api/courses",status="200"} 421
request_duration_seconds{route="/api/courses"} 0.083

Logs describe events, metrics summarize behavior over time, and traces connect work across services. Health checks should distinguish “process is alive” from “application is ready to receive traffic.”

Exercises

  1. Choose three metrics for an API and define alert thresholds.
  2. Explain how two service instances share sessions safely.
  3. Design a readiness check that verifies required dependencies.

Self-check

  1. Why externalize session state?
  2. What is the difference between liveness and readiness?
  3. What does a trace add to a log?

Self-Check Quiz

1. What makes a service easier to scale horizontally?

AnswerStateless request handling and externalized shared state allow requests to reach any healthy instance.

2. What should not be stored in source control?

AnswerSecrets such as passwords, private keys, and production tokens.

Homework

  1. Write a deployment checklist for a web API.
  2. Define logs, metrics, and traces for one user request.
  3. Describe graceful behavior when the database is unavailable.
Sample answerA checklist includes configuration validation, secret injection, migrations, health checks, rollback, and monitoring. A request trace links gateway, application, and database spans. Database failure should produce a bounded timeout, a useful 503 response, structured logs, and no leaked credentials.
👤