Map/Reduce Yielding

A key advantage of the map/reduce script type is that it can manage some aspects of its own resource consumption. This behavior is achieved through a feature known as yielding.

To understand yielding, first be aware that all map/reduce scripts are processed by SuiteCloud Processors. A processor is a virtual unit of processing power that executes a job.

With yielding, the system waits until after the completion of each map or reduce function invocation, then checks to see whether the job has exceeded certain limits. If it has, job gracefully ends its execution, making it possible for other jobs to gain access to the processor. A new job is created to take the place of the map/reduce job that ended. The new job has the same priority as the old one, but a later timestamp.

Yielding can occur after the following limits are surpassed:

Because the system checks these limits only between function invocations, yielding never interrupts a function invocation. Additionally, be aware that a job does not yield until it has passed one of the relevant limits.

Yielding is unrelated to the governance limits that exist for a single invocation of a map or reduce function. Those limits are described in Hard Limits on Function Invocations. Exceeding the limit for a single invocation of a map or reduce function causes the system to throw an SSS_USAGE_LIMIT_EXCEEDED error and ends the function invocation, even if it is not complete.

For help understanding how the map and reduce stages can each have multiple function invocations, review Map/Reduce Key Concepts.

Important:

Map/reduce yielding is automatic. There is no API for manually forcing a map/reduce job to yield. This behavior differs from the functionality that was available for SuiteScript 1.0 scheduled scripts.

Related Topics

SuiteScript 2.x Map/Reduce Script Reference
Map/Reduce Terminology
Map/Reduce Script Stages
Map/Reduce Script Submission
Map/Reduce Governance
Map/Reduce Script Status Page
Map/Reduce Script Testing and Troubleshooting
Map/Reduce Script Error Handling

General Notices