Search code examples
google-cloud-platformgoogle-cloud-run

Is there a practical difference between Google Cloud Run Jobs and GCP Batch Jobs?


Google Cloud Run is a serverless platform that can be used to run docker containers as batch jobs or as services.

Google Cloud Batch is a serverless platform that can be used to run docker containers as batch jobs.

Is there any practical difference or reason one should choose one or the other for batch data jobs? Is there any difference in pricing? One needs some auxiliary service that the other doesn't?

Looking at the documentations, both say that there is no cost of using the service itself, just the computing resources allocated to the job. There does not seem to be any practical difference in creating, deploying, observing or maintaining jobs using each service. Is there a difference?


Solution

  • That's a great question and indeed, there is no many differences

    • Cloud Run Jobs requires less configuration and it's simpler to use with a container. Therefore, it's much easier to run it with a simple API call
    • Batch is a more configurable solution. You can use container as you do with Cloud Run Job, but also raw script. You also have more options in the hardware configuration: more machine type, CPU, memory, and even GPU. You also don't have timeout with batch, compare to Cloud Run jobs which is limited to 24h (and soon many days). In term of network, because you run a VM in your VPC you are directly hosted in your VPC, and not in the serverless world as you are with Cloud Run jobs

    As often, in the cloud, you have several options to achieve the same thing. For simplicity, Cloud Run is great. For more advance, more specific, more fine-tuned use cases, Batch is the best solution.