Governance in SuiteScript - How NetSuite halts runaway scripts
阿新 • • 發佈:2018-11-13
Types of Governance Limits
- NetSuite API calls
- Script Instruction Count
- Script Timeouts
- Memory Usage
API Usage Limit
- Usage system based on "units"
- API functions have a unit cost for each invocation
- Scripts have a maximum number of units that can be spent
- Exceeding the limit results in SSS_USAGE_LIMIT_EXCEEDED
Common API Functions and Their Cost
Operation | Unit Cost |
Load a Saved Search | 5 |
Retrieve Search Results | 10 |
Request a URL | 10 |
Send an email | 10 |
Schedule a task | 10 |
Create an instance of a custom record | 2 |
Create an Employee record | 5 |
Create a Sales Order record | 10 |
Save a custom record | 4 |
Save a Contact record | 10 |
Save a Purchase Order record | 20 |
Maximum Units by Script Type
Script Type | Unit Threshold |
Client | 1,000 |
User Event | 1,000 |
Suitelet | 1,000 |
Portlet | 1,000 |
Workflow Action | 1,000 |
RESTlet | 5,000 |
Scheduled | 10,000 |
Map/Reduce | 10,000 |
Bundle Installation | 10,000 |
Mass Update | 10,000 pre record |
Timeouts and Instruction Count Limit
- Scripts that take too long to excute throw SSS_TIME_LIMIT_EXCEEDED
- Scripts that invoke too many instructions on the server throw SSS_INSTRUCTION_COUNT_EXCEEDED
- There is no documentation in Help for:
- Time limits for each script
- Instruction limits for each script
- What constitutes an "instruction"
Memory Usage Limit
- Script that use too much memory throw SSS_MEMORY_USAGE_EXCEEDED
- Variables, functions, data storage all contribute to memory usage
- Limits by Script Type:
- Scheduled: 50MB
- Map/Reduce: 50MB
- RESTlet Input/Output data: 10MB
- No documentation for other types