liveBook · Manning

Background processing

As explained in Kubernetes for Developers

Background processing is execution of application work asynchronously or outside the primary request-handling path.

Background processing moves work that does not fit comfortably inside a request-response cycle into an asynchronous task. The application accepts the request, schedules the work, and returns quickly while another process produces the result. section 10.0 section 10.1

Choose the Kubernetes workload according to how the work arrives and ends:

  • Use a continuously running Deployment for a task queue that handles ongoing application work, commonly coordinated with Redis. section 10.0 section 10.5
  • Use a Job for one-off maintenance, finite batch processing, or a queue that should terminate after completing its work. section 10.0 section 10.5
  • Use a CronJob when Jobs must run periodically, such as for daily cleanup. section 10.5

Generating a thumbnail

A thumbnail request first checks the cache. On a cache miss, the service queues thumbnail generation and returns a status telling the client to retry. A worker processes the task, and a later retry serves the cached thumbnail. Scaling workers from queue length avoids mixing fast cache requests with expensive image processing on the same request path. section 6.4.3

Figure 10.1 Frontend web server with a background task queue
10-01

Use the architecture figure to trace how a frontend web server hands heavy work to a background task queue. section 10.1

How Kubernetes for Developers covers it

How deep it goes
Explains continuous queues, finite Jobs, scheduled CronJobs, Redis coordination, retries, and worker health checks.
Examples
Uses thumbnail generation, image resizing, ZIP creation, notifications, data processing, and scheduled cleanup as examples.
What it assumes
Builds from request-response services and distinguishes the general task concept from Kubernetes’ Job object.
What you can do after
Operate/configure continuous task queues and define one-off, periodic, or finite batch workloads in Kubernetes.
How it connects
Connects request-response services with Deployments, Jobs, CronJobs, Redis, caching, retries, and liveness checks.

Also explained in

Compare how 4 books explain background processing →

Related concepts

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