Governance

“Governance” is the name given to NetSuite’s system for detecting and halting long-running, runaway, or resource-intensive scripts.

Each script type has governance limits that it cannot exceed, and there are four types of governance limits in place for each script type.

  • API usage limit
  • Instruction Count limit
  • Timeout limit
  • Memory usage limit

Below are a few examples of unit costs for common operations. For an exhaustive list of Governance costs, see the article titled “API Governance” in NetSuite Help.

OperationUnit Cost
Loading a Saved Search5
Retrieving Search Results10
Scheduling a task10
Requesting a URL10
Sending an email10
Creating a custom record2
Creating an Employee record5
Creating a Sales Order record10
Saving a custom record4
Saving a Contact record10
Saving a Purchase Order record20

These are the usage limits by script type:

Script TypeUsage Limit
Client1,000
User Event1,000
Suitelet1,000
Portlet1,000
Workflow Action1,000
RESTlet5,000
Scheduled10,000
Map/Reduce10,000
Bundle Installation10,000
Mass Update10,000 per record

If a script takes too much time to run, NetSuite will stop it by throwing an SSS_TIME_LIMIT_EXCEEDED error.

In addition, runaway scripts can be detected and halted based on their “Instruction Count”. If the defined instruction count limits are exceeded, NetSuite will stop the script by throwing an SSS_INSTRUCTION_COUNT_EXCEEDED error.

It is simply important to know that if you encounter either the SSS_TIME_LIMIT_EXCEEDED error or the SSS_INSTRUCTION_COUNT_EXCEEDED error in one of your scripts, you have processing that is taking too long. Focus your investigation on your loop structures to determine where optimizations may be made.

If your script exceeds the memory usage limit, NetSuite will terminate your script by throwing a SSS_MEMORY_USAGE_EXCEEDED error.

Every variable declared, every function defined, every Object stored contributes to the memory usage of your script.

Both the Scheduled Script and the Map/Reduce Script have documented 50MB memory limits. There is also a documented limit of 10MB for the size of any String passed in to or returned from a RESTlet. There is no other documentation on the specific limits for a given script.

Leave a comment

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