Google Cloud Platform Blog
Product updates, customer stories, and tips and tricks on Google Cloud Platform
Reliable task scheduling on Google Compute Engine
June 11, 2015
Many systems require regularly scheduled tasks, but getting them to run reliably in a distributed environment can be surprisingly hard.
Imagine trying to run the standard UNIX cron service in a fleet of virtual machines. Individual machines come and go due to autoscaling and network partitioning. A critical task might never run because the instance it was scheduled on became unavailable. Or a task meant to run only once might be duplicated by many servers as your autoscaler brings them online.
Using Google
App Engine’s Cron service
for scheduling and
Google Cloud Pub/Sub
for messaging, you can build a distributed and fault-tolerant scheduler for your virtual machines. We’ll teach you how in our
Reliable Task Scheduling for Google Compute Engine
a
rticle, which includes
code for a sample implementation
on GitHub.
In this design pattern, a lightweight App Engine application schedules events in the Cron service. When the Cron service calls this application’s event handlers, the App Engine application uses Cloud Pub/Sub to relay the events to a utility running on each Compute Engine instance.
When the subscribing utility receives a message, it runs a script corresponding to the Cloud Pub/Sub topic. The scripts run locally on the instance just as if they were run by Cron. In fact,
you can reuse existing Cron scripts
with this design pattern.
Using Cloud Pub/Sub for distributed messaging means that you can schedule an event to only run on one of many servers, or to run the task on several servers concurrently. The topic and subscriber model (shown in the diagram below) gives you fine-grained control over which instances receive a given task.
Figure 1 - Using App Engine Cron from Compute Engine
For a detailed explanation of this design pattern, check out our
Reliable Task Scheduling for Google Compute Engine
a
rticle, which includes
a sample implementation
on GitHub. Feel free to make pull requests or open issues directly on the open source sample, or ping me at @ptone on twitter if you find this useful.
- Posted by Preston Holmes, Solutions Architect
No comments :
Post a Comment
Free Trial
Labels
Android
Announcement
api
app engine
Atmosphere Live
bigquery
BigTable
CDN
Cloud Console
Cloud Dataflow
Cloud Datastore
cloud endpoints
Cloud Pub/Sub
Cloud SDK
cloud sql
cloud storage
Cloudera
Compute
Compute Engine
container cluster
customer
Dev Tools
developer tools
developer-insights
Developers
Developers Console
devfests
Disaster Recovery
Encryption Keys
ESG
Event
events
GA
Go Client
Google App Engine
Google Apps
Google BigQuery
Google Cloud Deployment Manager
Google Cloud Networking
Google Cloud Platform
Google Cloud Storage
Google Compute Engine
Google Container Engine
gRPC
hadoop
Hardware
Helium
how to
IO2013
iOS
Kubernetes
Levyx
Local SSD
mapreduce
Media
Nearline
networking
open source
PaaS Solution
Partner
Pricing
Research
round-up
Server
Siggraph
solutions
Startup
Tableau
TCO
Technical
Windows
Wowza
Zync
Archive
2015
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2014
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2013
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2012
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2011
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2010
Dec
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2009
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2008
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Feed
Technical questions? Check us out on
Stack Overflow
.
Subscribe to
our monthly newsletter
.
Follow @googlecloud
No comments :
Post a Comment