How Yielding Works in Map/Reduce Script Execution

How It Works

During the map and reduce stages, after each function invocation, the system checks how long the job has been running. If the elapsed time exceeds the value set in the Yield After Minutes field, the job ends gracefully. A new job is then created to continue processing, maintaining the same priority but with a later timestamp. This process is known as yielding.

Default and Custom Values

  • The default value is 60 minutes.
  • You can set any value between 3 and 60 minutes.

Important Notes

  • The system does not interrupt a function invocation mid-execution.
  • Yielding only occurs after the time limit is exceeded, not before.
  • If a function takes longer than the set limit, the job yields only after the function completes.
  • Example: If the limit is set to 3 minutes but the function runs for 15 minutes, the job yields after 15 minutes.

Governance Limit

Yielding is also influenced by a governance limit of 10,000 usage units per map or reduce job. Similar to the time-based limit, this is checked after each function invocation. If the usage exceeds the limit, the job yields—even if the time limit hasn’t been reached.

Leave a comment

Your email address will not be published. Required fields are marked *