Serverless functions (also known as functions as a service) can help you simplify your integrations because you only need to code your logic in a function and the service provider will take care of all the backend hardware, scaling, OS, availability, instances, etc…
Other benefits of serverless technology are that the hardware and software is fully managed, scales automatically almost instantly, and you only pay whenever your function runs so it can be very inexpensive.
Some of the most popular serverless providers are Amazon Lambda, Azure Functions and Google Cloud Functions.
Spoiler: 50 concurrent Suitelet win. (Tested in Sandbox)
I am a big fan of Map Reduce scripts, spreading the load among 5 queues makes a huge difference when processing your data. Unfortunately to take advantage of the concurrent queues feature your account must have a SuiteCloud plus license.
So I figured it would be cool to simulate this feature with Suitelets. Suitelets support up to 50 concurrent connections and they are available without the need of SuiteCloud plus.
The results were very surprising.
Task: Create and delete a custom record with no fields.
Account: Account with SuiteCloud Plus license in Sandbox.
Map Reduce: Run task 10k times by returning an array of 10k elements on the getInputData step and let the reduce step handle the main logic.
Suitelet SS2.0: Run task once per call. Return “OK” as response. Available without login (External).
Use Apache JMeter to call the Suitelet 10k times.
Additionally call the Suitelet using Ajax with browser (Chrome) 5k times (to avoid browser memory issues).
Map Reduce w/buffer size of 1 : 196 seconds ~ 51 per second
Map Reduce w/buffer size of 64: 518 seconds ~ 19 per second
Suitelet w/JMeter w/50 at a time: 55 seconds ~ 181 per second
Suitelet w/JMeter w/100 at a time: 30 seconds ~ 333 per second
Suitelet w/JMeter w/200 at a time: 24 seconds ~ 416 per second
Suitelet w/JMeter w/250 at a time: 24 seconds ~ 416 per second
Suitelet w/JQuery: 1000/44 secs ~ 22 per second
As you can see, I ran multiple test variations. After I saw that the Suitelet was able to handle 50 requests at a time I went crazy and increased the number of concurrent requests. I got up to 250 requests being handled successfully. Once I reached 300 requests at a time I started getting errors and not all the records were successfully created.
As you can see, after 200 requests you pretty much get the same speed. This could be caused by my system, JMeter, my internet connection or by some throttling happening on the Netsuite side, I don’t know.
This approach can be pretty handy if you ever need to process large quantities of records and you need even more speed than what Map Reduce gives you. You would need to develop your Suitelet in a way that even if something goes wrong you have a way to identify the errors and retry the operations. Additionally, you would need to get a tool that bypasses the browser restrictions such as Apache JMeter and configure it if you need to pass any data to the Suitelet.
Anyways, the difference is huge. Basically you could process 1 million records in 40 mins in the Suitelet vs 5:30 hrs in a Map Reduce… and this is in Sandbox, go figure how faster this would be in Production.
You are not crazy, SS2.0 External Suitelets don’t run clientside code
Hey guys, just letting you know that I encountered an issue recently. I was trying to create a Suitelet “Available without Login” that uses a form and I was attaching a button and a clientscript to it, but guess what? The button doesn’t work. I checked the console and every time I call the button I get “require is not defined” error:
So I stripped the suitelet to the most barebones version and I still got the error. I verified with others and it seems to be a defect from SS2.0 External Suitelets.
At the end of the day I was able to run the code by hacking the dom like so: