Statefulness
Statefulness is the property of a system or operation whose behavior or results depend on information retained or changed across interactions or executions.
Kafka for Architects
A stateful system is a system whose behavior or operation depends on data maintained across requests or processing intervals.
- How it is used
- Frames real-time aggregations and joins as operations that retain context across events.
- How deep it goes
- Explains keyed counters, local stores, changelog recovery, and restoration bottlenecks without walking through an implementation.
- Examples
- Uses orders counted by region, hourly order counts, and a customer view joining transactions with profiles.
- What you can do after
- Apply it via Kafka Streams to design keyed, fault-tolerant aggregations and plan for state restoration.
Kafka Streams in Action, Second Edition
A stateful application is a program that retains processing state across multiple input events.
- How it is used
- Uses retained event history to support Kafka Streams reductions, aggregations, joins, and more complex streaming decisions.
- How deep it goes
- Explains keyed state updates through reduce, automatic stores, naming effects, and TopologyTestDriver inspection without detailing store internals.
- Examples
- Demonstrates widget counting, per-player poker-score reduction, topology naming after a filter, and state-store assertions in tests.
- What you can do after
- Build stateful Kafka Streams topologies with keyed operations, stable store names, and tests that inspect outputs and stored results.
Read how Kafka Streams in Action, Second Edition explains statefulness →
React Quickly, Second Edition
A stateful application is an application whose behavior or user-interface output depends on data that can change over time.
- How it is used
- Makes React interfaces respond to clicks, form input, login, and other changes over time.
- How deep it goes
- Explains stateful versus stateless components, functional state setup and updates, shared state scope, and class-based differences without full class examples.
- Examples
- Uses a login form, clocks, counters, and a multicomponent to-do application with filter buttons and tasks.
- What you can do after
- Build it from scratch with `useState` and properties to make components interactive and share changing values.
Read how React Quickly, Second Edition explains statefulness →
Kubernetes for Developers
A stateful application depends on persistent or retained state across requests, executions, or instance replacements.
- How it is used
- Motivates storage-backed deployment when an application must keep data alongside workloads such as stateless frontends.
- How deep it goes
- Explains single-replica storage attachment and disk-retention consequences, then points to StatefulSet for multi-replica workloads.
- Examples
- Uses a single-Pod MariaDB deployment and a Redis recovery exercise that checks stored values after workload recreation.
- What you can do after
- Operate/configure it by attaching a storage claim and choosing a reclaim policy that preserves needed disk data.
Kubernetes in Action, Second Edition
A stateful backend is a backend application component whose operation depends on retained application or client state.
- How it is used
- Frames storage, identity, and lifecycle decisions for backend workloads whose operation depends on retained state.
- How deep it goes
- Explains storage conflicts, replica identity, lifecycle behavior, and Kubernetes automation without detailing application-specific state management.
- Examples
- Uses the Quiz service, MongoDB volume locking, ordinal pods, per-replica claims, and the pets-versus-cattle analogy.
- What you can do after
- Operate/configure stateful workloads with StatefulSets, per-replica storage, stable identities, and lifecycle policies.
Read how Kubernetes in Action, Second Edition explains statefulness →
Google Anthos in Action
A stateful application retains client-session or other operational state that can affect subsequent requests.
- How it is used
- Guides migration deployment choices by distinguishing applications whose requests depend on retained client-session data.
- How deep it goes
- Defines statefulness through session retention and prior transactions, then stops short of detailing stateful deployment YAML.
- Examples
- Uses a migrated VM and generated deployment_spec.yaml to contrast stateful behavior with a stateless Kubernetes deployment.
- What you can do after
- Evaluate whether requests from a user must reach the same server during migration and deployment.
Functional Design and Architecture: Examples in Haskell
A stateful application is an application whose behavior depends on information retained across operations or interactions.
- How it is used
- Organizes retained information and side effects in functional applications without allowing mutable state to spread through business logic.
- How deep it goes
- Explains immutable state, state monads, mutable mechanisms, architectural boundaries, and concurrent granularity, but defers broader persistence details.
- Examples
- Uses a sandwich interpreter, ingredient inventory, IORef, key-value simulation, nested MVars, and coarse- versus fine-grained maps.
- What you can do after
- Build stateful functional applications by separating pure logic from interpreters and controlling mutable state at explicit architectural boundaries.
Read how Functional Design and Architecture: Examples in Haskell explains statefulness →
Real-World Cryptography
A stateful signature scheme requires persistent state, such as a counter, to prevent reuse of one-time signing material.
- How it is used
- Warns that XMSS and XMSSMT require persistent signing state to avoid reusing one-time keys.
- How deep it goes
- Explains counters, Merkle-tree paths, regeneration, and operational reuse failures without detailing storage implementation.
- Examples
- Uses filesystem rollback and shared signing keys across servers to illustrate one-time-key reuse.
- What you can do after
- Diagnose/debug state-reuse hazards when deploying stateful hash-based signatures.
Data-Oriented Programming: Reduce software complexity
Stateful code is code whose behavior or effects involve persistent state beyond the values passed directly to a computation.
- How it is used
- Tests mutations whose effects appear in persistent system state rather than direct return values.
- How deep it goes
- Explains state retrieval, mutation, commit, and comparison, while stopping short of deeper state-management internals.
- Examples
- Uses member addition, existing-member rejection, library state, system state, and expected-state comparisons.
- What you can do after
- Diagnose/debug with it by asserting the state produced by a mutation and checking expected exceptions.
Read how Data-Oriented Programming: Reduce software complexity explains statefulness →
Learn Docker in a Month of Lunches, Second Edition
A stateful application is an application whose behavior or future results depend on data retained from prior interactions or executions.
- How it is used
- Uses statefulness to explain why containerized applications need persistent storage and how Docker volumes provide it.
- How deep it goes
- Explains retained data through Docker volumes, mounts, directories, and container replacement, without detailing application storage internals.
- Examples
- Demonstrates a containerized to-do list that stores items in /data and retains them across application container updates.
- What you can do after
- Apply it via Docker volumes to preserve application data while replacing or updating containers.
Read how Learn Docker in a Month of Lunches, Second Edition explains statefulness →
AI for Everyday IT
Statefulness is the ability of a system to remember previous interactions or states and use that information in subsequent interactions.
- How it is used
- Uses statefulness to explain how conversational AI can build on earlier exchanges instead of treating every prompt as a separate query.
- How deep it goes
- Defines statefulness and contrasts it with stateless interactions, while noting that context has limits and can require reminders.
- Examples
- Uses chatbot follow-ups, independent search queries, API calls, and a prolonged ChatGPT conversation to illustrate state and context limits.
- What you can do after
- Apply stateful chat by asking follow-ups or clarifying details, and restate key points when responses lose relevance.
Functional Programming in Scala, Second Edition
A stateful API is a program interface whose behavior or results depend on state maintained across interactions.
- How it is used
- Uses random number generation to establish a general pattern for converting stateful APIs into pure functional APIs.
- How deep it goes
- Explains explicit state transitions, manual threading, and State abstractions, while deferring broader effects to later treatment.
- Examples
- Demonstrates RNG transitions through randomPair, nonNegativeInt, numeric combinations, and lists of generated integers.
- What you can do after
- Build it from scratch by translating mutable APIs into explicit state transitions and composing them with State operations.
Read how Functional Programming in Scala, Second Edition explains statefulness →
AI Model Evaluation
A stateful operation is an operation whose effects depend on or modify persistent application or external system state.
- How it is used
- Guides safe shadow-traffic evaluation when requests can modify databases or trigger external-system side effects.
- How deep it goes
- Explains duplicate writes, external side effects, isolation, interception, and resource overhead without detailing implementation code.
- Examples
- Uses database writes, emails, notifications, tickets, payments, calendars, and workflow-triggering APIs as concrete side-effect examples.
- What you can do after
- Operate shadow evaluations with isolated stores, dry-run adapters, sandboxed APIs, read-only credentials, or intercepted effects.
Road to Kubernetes
A stateful containerized application is a containerized application whose behavior or data depends on persistent state across operations or restarts.
- How it is used
- Frames persistent data as a deployment challenge when moving databases and other stateful systems into containers or clusters.
- How deep it goes
- Defines statefulness, contrasts it with stateless containers, and demonstrates temporary changes without detailing persistent-storage implementation.
- Examples
- Uses databases, Python and Node.js applications, and an Ubuntu container with an installed NGINX server.
- What you can do after
- Evaluate/understand why databases need persistence and why container images should replace ad hoc changes inside running containers.
React in Depth
A stateful component is a React component that maintains state and can trigger updates when that state changes.
- How it is used
- Uses statefulness as a target for inspecting, manipulating, and diagnosing React component behavior.
- How deep it goes
- Explains state inspection and re-render effects, while stopping short of state-management architecture or hook internals.
- Examples
- Demonstrates state inspection with a dark-mode application, useState, useReducer, and context provider values.
- What you can do after
- Diagnose state behavior by inspecting and temporarily changing component or provider values in React Developer Tools.
Also covered in
- React Hooks in Action: With Suspense and Concurrent Mode
- Architecting an Apache Iceberg Lakehouse
- API Design Patterns
- Grokking Software ArchitectureIn early access (MEAP)
- MongoDB 8.0 in Action, Third Edition
- Apache Kafka in Action
- Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu
- Think Distributed Systems
- Build AI-Enhanced Web Apps
- AI Agents and Applications
- Distributed Machine Learning Patterns
What to know first
- stateless systemA stateless system processes each operation independently, without relying on interaction or mutable execution state retained from earlier operations.
- functional programmingFunctional programming is a programming paradigm that expresses computation through the evaluation and composition of functions, typically favoring immutable data and minimizing mutable state and side effects.
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- SQLSQL is a standardized declarative language for defining, querying, and manipulating data in relational database systems.
Related concepts
- stateless systemcontrasts with · A stateless system processes each operation independently, without relying on interaction or mutable execution state retained from earlier operations.
- databaseincludes · A database is an organized persistent data store, typically managed by software, that supports storing, retrieving, and modifying data.
- stateuses · State is information describing the condition or configuration of a system or computation at a particular time that may influence its behavior or subsequent transitions.
- state storeuses · A state store is a storage component that maintains application or processing state and provides mechanisms to access or update it.
- StatefulSetimplemented by · A StatefulSet is a Kubernetes workload resource that manages stateful Pods with stable identities, ordered operations, and persistent storage associations.
- conversational aiused by · Conversational AI is artificial intelligence that enables software systems to interpret user input and interact with users through natural-language dialogue.
Questions about statefulness
What is statefulness?
Statefulness is the property of a system or operation whose behavior or results depend on information retained or changed across interactions or executions.
Which Manning books explain statefulness?
Kafka for Architects, Kafka Streams in Action, Second Edition, React Quickly, Second Edition, Kubernetes for Developers, Kubernetes in Action, Second Edition, Google Anthos in Action, Functional Design and Architecture: Examples in Haskell, Real-World Cryptography and 7 more.
What should I know before learning statefulness?
Manning books that teach statefulness usually introduce stateless system, functional programming, language model and SQL first.
What is the difference between statefulness and stateless system?
Statefulness is the property of a system or operation whose behavior or results depend on information retained or changed across interactions or executions. A stateless system processes each operation independently, without relying on interaction or mutable execution state retained from earlier operations.
What kinds of statefulness are there?
Kinds of statefulness include database.
What is statefulness also called?
Statefulness is also called stateful.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.














