SuiteScript Governance Limits and Performance in NetSuite

Understand SuiteScript governance in NetSuite, focusing on usage units, script limits, and best practices for performance optimization.

·2 min read·View Oracle Docs

NetSuite employs a SuiteScript governance model to enhance performance by managing usage units. This governance structure ensures that if your scripts exceed their allowable usage units, execution will be terminated, maintaining system stability.

Understanding Usage Units

Usage units in NetSuite are categorized by script type and API usage. Each SuiteScript type, as well as each API method, has a predefined number of usage units allocated to it. This ensures efficient resource management while executing scripts. For instance, when using map/reduce scripts, you must adhere to limits such as:

  • Key Length: Limited to 3,000 characters. Exceeding this limit results in the error KEY_LENGTH_IS_OVER_3000_BYTES.
  • Value Size: Limited to 10 MB, failing which you will encounter the error VALUE_LENGTH_IS_OVER_10_MB.

Best Practices for Map/Reduce Scripts

When utilizing methods like mapContext.write() or reduceContext.write(), follow these best practices:

  • Keep key strings under 3,000 characters.
  • Ensure value strings do not exceed 10 MB.
  • Aim to use values for data transfer instead of keys to optimize execution.

More details regarding usage limits for specific SuiteScript 2.x APIs can be found in the governance documentation for each method depending on their respective modules.

Governance Limits Beyond Usage Units

Limits also apply to various aspects of script execution, including:

  • Search Results: The number of results returned by a search is restricted.
  • Execution Time: Each script type is allocated a specific maximum run time, ensuring that no single process monopolizes resources.

For deeper insights into the governance features, review the following resources:

  • Script Type Usage Unit Limits
  • SuiteScript 2.x API Governance
  • Monitoring Script Usage
  • Governance on Script Logging
  • Search Result Limits
  • Script Execution Time Limits

By adhering to these limits and best practices, you can ensure your scripts run efficiently and without unnecessary termination due to governance violations.

Who This Affects

  • Developers: Responsible for writing and optimizing SuiteScripts.
  • Administrators: Overseeing script management and performance.
  • Support Teams: Addressing issues related to script execution and governance limits.

Source: This article is based on Oracle's official NetSuite documentation.

Key Takeaways

  • SuiteScript governance manages resource usage through defined limits.
  • Keys and values in scripts must adhere to specified character and size limits.
  • Governance also tracks execution time and search result counts to maintain system performance.

Frequently Asked Questions (4)

What is the limit for key length when using map/reduce scripts in NetSuite?
The key length is limited to 3,000 characters, and exceeding this limit results in the error 'KEY_LENGTH_IS_OVER_3000_BYTES'.
How can I optimize script performance using map/reduce scripts in SuiteScript?
You should keep key strings under 3,000 characters, ensure value strings do not exceed 10 MB, and aim to use values for data transfer instead of keys to optimize execution.
What are the execution time limits for SuiteScript types?
Each SuiteScript type has a specific maximum run time allocated to prevent any single process from monopolizing resources. Refer to SuiteScript 2.x API documentation for detailed limits per script type.
How does NetSuite ensure resource management through SuiteScript governance?
NetSuite employs a governance model with predefined usage units for each script type and API method. This ensures scripts do not exceed their allowable usage units, maintaining system stability and performance.
Source: SuiteScript Governance and Limits Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in General

View all General articles →