liveBook · Manning

State

As explained in Platform Engineering on Kubernetes

Application state is the data that represents an application's current condition and must persist across requests or component executions.

Application state is the data representing a service’s current condition. In Kubernetes, its location determines whether replicas can serve requests consistently and scale with demand. section 2.4 section 2.4.3

Design state handling around the service’s scaling and failure behavior:

  • Store state outside pod memory, using components such as Redis or PostgreSQL, so multiple replicas can access shared data. section 2.4.3
  • Treat in-memory state as a scaling constraint: load balancing requests across replicas can produce different results when each pod has separate data. section 2.4.3
  • Review database connection-pool settings as replicas increase, because every replica can create connections against the database. section 2.4.3
  • Handle HTTP sessions deliberately when subsequent requests must reach the same replica, including the need for session replication or sticky sessions. section 2.4.3

Scaling the Conference Agenda service

Run the Agenda service with two replicas. Kubernetes load-balances Frontend requests between them, while Redis keeps the agenda state outside pod memory. If the service instead stores agenda items in memory, each replica can expose different data and scaling becomes unreliable. section 2.4.3

How Platform Engineering on Kubernetes covers it

How deep it goes
Explains external stores, in-memory limitations, connection pools, and sessions, but stops short of implementing session replication.
Examples
Demonstrates Conference Agenda replicas backed by Redis and contrasts them with agenda data kept in pod memory.
What it assumes
Assumes familiarity with services, replicas, load balancing, and persistent stores while identifying state handling as an architectural concern.
What you can do after
Diagnose scaling problems by comparing replica behavior, external persistence, database connections, and in-memory data.
How it connects
Connects application state with Kubernetes, Redis, PostgreSQL, load balancing, data consistency, and sticky sessions.

Also explained in

Compare how 39 books explain state →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Platform Engineering on Kubernetes. The section links point to the parts of the book it draws on.