3

We have been using Google Cloud Functions with http-triggers, but ran into the limitation of a maximum timeout of 540 s.

Our jobs are background jobs, typically datapipelines, with processing times often longer than 9 minutes.

Do background functions have this limit, too? It is not clear to me from the documentation.

Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96
dkapitan
  • 859
  • 2
  • 10
  • 21

3 Answers3

3

All functions have a maximum configurable timeout of 540 seconds.

If you need something to run longer than that, consider delegating that work to run on another product, such as Compute Engine or App Engine.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
3

2nd Generation Cloud Functions that are triggered by https can have a maximum timeout of 1 hour instead of the 10 minute limit.

See also: https://cloud.google.com/functions/docs/2nd-gen/overview

Cloud Functions 2nd gen max timeout 3600 sec

You can then trigger this 2nd gen Cloud Function with for example Cloud Scheduler.

When creating the job on Cloud Scheduler you can set the Attempt deadline config to 30 minutes. This is the deadline for job attempts. Otherwise it is cancelled and considered a failed job.

See also: https://cloud.google.com/scheduler/docs/reference/rest/v1/projects.locations.jobs#Job

cloud scheduler job attempt deadline config

Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96
2

The maximum run time of 540 seconds applies to all Cloud Functions, no matter how they're triggered. If you want to run something longer you will have to either chop it into multiple parts, or run it on a different platform.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807