Measure resource governance within map reduce
# ask-stanley-ai
s
Measure resource governance within map reduce
c
AI generated answer (using internal Slack threads):
Resource governance within Map/Reduce in NetSuite is a crucial aspect to consider when designing and implementing scripts. It's important to understand that the governance limit for the Map/Reduce script type is 10,000 units for the getInputData, map, and summarize stages, and 5,000 units for the reduce stage. From the conversations, it's clear that there are several strategies to manage and optimize resource governance within Map/Reduce: 1. Optimize Data Processing: Instead of processing all results in one reduce, it's recommended to utilize the map/reduce schema, which sends each result individually to the map entry. This way, you're not processing all results in one entry of map, and in most cases, the governance limit doesn't matter in Map/Reduce. 2. Use Map for Grouping: If you're running out of governance, consider how you're getting the data and if you can group it down in a map phase. This can help to optimize the data set and reduce the governance usage. 3. Chunking: If you know you can only process a certain amount, you should be able to see how many keys/values you are processing/already processed in the map phase and maybe add a key that has an updated key based on the set like "keyA-set1", "keyA-set2". This can help to distribute the processing and manage the governance usage. 4. Use RESTlet for Extra Units: If you're running out of governance, you could consider moving some of the processing to a RESTlet, which has a separate governance limit of 5000 units. However, this is not scalable if you have even more data to process. 5. Optimize Reduce Data Set in Map: The RESTlet would buy you 5000 extra units but that's not scalable if you were to happen to have even more that's why it's suggested trying to optimize your reduce data set in map. 6. Implement Data Fetching and Grouping in getInputData: Another option is to implement the data fetching and grouping yourself in getInputData and free up the map for processing. Remember, a properly designed Map/Reduce script will never run out of governance. It's all about understanding how Map/Reduce works and designing your solution efficiently. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826327324
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.806842268
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.80404973
Please provide your feedback on this answer.