Reader small image

You're reading from  Kubernetes for Developers

Product typeBook
Published inApr 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781788834759
Edition1st Edition
Languages
Right arrow
Author (1)
Joseph Heck
Joseph Heck
author image
Joseph Heck

Joseph Heck has broad development and management experience across start-ups and large companies. He has architected, developed, and deployed a wide variety of solutions, ranging from mobile and desktop applications to cloud-based distributed systems. He builds and directs teams and mentors individuals to improve the way they build, validate, deploy, and run software. He also works extensively with and in open source, collaborating across many projects, including Kubernetes.
Read more about Joseph Heck

Right arrow

A worker queue example with Python and Celery


Where the CronJob is well positioned to run repeated tasks at a specific schedule, another common need is to process a series of work items more or less constantly. A job is well oriented to running a single task until it is complete, but if the volume of things you need to process is large enough, it may be far more effective to maintain a constant process to work on those items.

A common pattern to accommodate this kind of work uses a message queue, as shown here:

With a message queue, you can have an API frontend that creates the work to be run asynchronously, move that into a queue, and then have a number of worker processes pull from the queue to do the relevant work. Amazon has a web-based service supporting exactly this pattern of processing called Simple Queue Service (SQS). A huge benefit of this pattern is decoupling the workers from the request, so you can scale each of those pieces independently, as required.

You can do exactly the same...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Kubernetes for Developers
Published in: Apr 2018Publisher: PacktISBN-13: 9781788834759

Author (1)

author image
Joseph Heck

Joseph Heck has broad development and management experience across start-ups and large companies. He has architected, developed, and deployed a wide variety of solutions, ranging from mobile and desktop applications to cloud-based distributed systems. He builds and directs teams and mentors individuals to improve the way they build, validate, deploy, and run software. He also works extensively with and in open source, collaborating across many projects, including Kubernetes.
Read more about Joseph Heck