Hi All, I am using Map/Reduce script and it reques...
# suitescript
s
Hi All, I am using Map/Reduce script and it requests to 3rd party API. But I got error of
SSS_USAGE_LIMIT_EXCEEDED
How can I resolve this error?
a
That's a governance error I think? What stage is erroring? 3rd party API shouldn't make a difference for this. if its in the GIS then you have 10k governance if its in the map stage you have 1k governance (per instance) reduce stage you have 5k governance (per instance) summary stage... i think is also 10k?
without more info I'm gonna guess you're making an API call in the map stage that pulling back a lot of data and you're processing it in the map stage, you should probably look into just categorizing that data and do a context.write to the reduce for the processing to happen there (and ideally in a more efficient way)
s
I write 3rd party API request in the GIS
I use only GIS. Making an API call and process in there
e
How many requests are you making? What are you doing to process this data during
getInputData
? If you're doing everything in
getInputData
, it's likely using up all the governance
s
Overall, you shouldn’t be doing a lot of intensive work in the GIS stage. If you are making a bunch of repeated calls to an external API, you have two options: either figure out a way to pre-divide the work, so that you can make just one call in either the map or reduce phase instead (the best case), or, if you can’t predetermine the calls, perhaps you need to know some value from the last call’s output to make the next one, for example, then this would be better suited for a scheduled script where you check for remaining governance and reschedule as needed. Using a Map/Reduce but only the GIS phase is worse than a scheduled script, because it will run out of governance sooner, and provides you no additional benefit unless you have a way to divide the work somehow
1
Or, if you are just making one call to an external API in the GIS, then you should be returning an array or object from the GIS so that the map or reduce phase cal process the work. You would get a fresh allowance of governance for each object key or array element that way.