SuiteScript Governance and Limits
To optimize application performance, NetSuite uses a SuiteScript governance model based on usage units. If the number of allowable usage units is exceeded, the script execution is terminated.
Usage units are tracked on two levels: the script type level and the API level. Each script type can execute a system-defined number of usage units, and each SuiteScript API can consume a system-defined number of usage units.
The character limit for keys in map/reduce scripts (specifically, in mapContext or reduceContext objects) is 3,000 characters. In addition, error messages are returned when a key is longer than 3,000 characters or a value is larger than 10 MB. Keys longer than 3,000 characters will return the error KEY_LENGTH_IS_OVER_3000_BYTES. Values larger than 10 MB will return the error VALUE_LENGTH_IS_OVER_10_MB.
If you have map/reduce scripts that use the mapContext.write(options) or reduceContext.write(options) methods, make sure that key strings are shorter than 3,000 characters and value strings are smaller than 10 MB. Make sure that you consider the potential length of any dynamically generated strings, which may exceed these limits. You should also avoid using keys, instead of values, to pass your data.
The governance limits for each SuiteScript 2.x API are included in individual SuiteScript 2.x method topics. Methods are organized by modules, and all modules are listed in the help topic SuiteScript 2.x Modules. A summary table is also available in this Developer Guide (see SuiteScript 2.x API Governance).
SuiteScript thresholds are based on the volume of activity that a company's users can manually generate. However, automated functions that generate excessive levels of activity may trigger metering of script execution as referenced in the NetSuite Main Terms of Service (TOS).
See the following help topics to learn about usage unit governance as it applies to specific script types, individual APIs, monitoring, and logging:
Related to governance, limits are enforced on certain aspects of script execution. When you run a search using the N/search module, the number of search results you receive is limited. There are also limits on the amount of time a script can run, based on the script type. See the following help topics to learn about these limits:
NetSuite uses internal mechanisms to detect scripts that may include infinite loops when executing. When they occur, script execution is terminated and an SSS_INSTRUCTION_COUNT_EXCEEDED
error message is thrown. If you receive this error, you should examine all of the execution loops in your script to ensure that they contain either a terminating condition or a condition that can be met.