Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Google Cloud Scheduler and GAE cron job?

After reading the docs

  • cloud scheduler - https://cloud.google.com/scheduler/
  • GAE cron job - https://cloud.google.com/appengine/docs/flexible/nodejs/scheduling-jobs-with-cron-yaml
  • cloud function pub/sub trigger - https://cloud.google.com/functions/docs/calling/pubsub

I think they are mostly the same.

I can use GAE cron job + pub/sub + cloud function to implement the same functions which cloud scheduler has.

In my understanding, it seems there are some differences between them:

  1. Cloud Scheduler can be more convenient to adjust frequency. To update the frequency of GAE cron job, you must update the config, like schedule: every 1 hours of cron.yaml and redeploy.

  2. There is no need to implement the cron job architecture(integrate GAE, GAE cron service, pub/sub, cloud function, etc..) by yourself which means you don't need to write code for combining them together anymore.

Am I correct? Or, any other differences?

like image 424
slideshowp2 Avatar asked Jan 09 '19 08:01

slideshowp2


People also ask

What is cron job in Google Cloud Platform?

Cron jobs are scheduled at recurring intervals specified using the Unix cron format. You can define the schedule so that your job runs multiple times a day, or runs on specific days and months. This gets you any serverless articles delivered right to your inbox every day without you having to do a thing.

What is GCP Cloud Scheduler?

Cloud Scheduler is a fully managed enterprise-grade cron job scheduler. It allows you to schedule virtually any job, including batch, big data jobs, cloud infrastructure operations, and more. You can automate everything, including retries in case of failure to reduce manual toil and intervention.

Does Cloud Scheduler need App Engine?

Users are no longer required to create an App Engine application to use Cloud Scheduler.


1 Answers

You're right in that the Google Cloud Scheduler is kind of an evolution of the GAE cron job mechanism to make it more user-friendly and flexible. You can see that they are still related since the Cloud Scheduler doc specifies:

To use Cloud Scheduler your project must contain an App Engine app that is located in one of the supported regions. If your project does not have an App Engine app, you must create one.

Historically, GAE cron job was the only cron service offered by the platform. You could only target a GAE handler to receive the request from cron. From there you could indeed perform actions like like publish on pub/sub, call an HTTP Cloud Function or launch a dataflow job, but you always had to deploy a GAE service to handle it, which wasn't optimal.

The new Cloud Scheduler (still in beta as of now) makes it more straightforward to use with Pub/Sub, Cloud Functions but also any publicly available HTTP endpoint (may be on-premise). And of course App Engine handlers. More targets may be added in the future for more use-cases.

Finally, as you mentioned, the API exposed to manage it decouples it from App Engine and its cron.yaml file and makes it easier to create and update cron jobs dynamically.

like image 180
LundinCast Avatar answered Sep 21 '22 11:09

LundinCast