This test case features a CPU-intensive Alu application with two execution phases: in the first phase, it connects to S3 and requests for a number N (Load configuration phase); in the second phase, 100 threads are spawned to conduct arithmetic calculations and loop for N times (Compute phase).
The workload is basically built by aws sam-cli.
We provide two versions of the application to compare their needs on resources:
- a together version (together.py), in which the application runs as a single serverless function;
- a splitted version, in which the application is splitted into two serverless functions (keyDownloader.py and alu.py) in a function chain. Each of the function handling one of the execution phase, respectively.
keyDownloader downloads the file named "loopTime.txt", which stores a number as the loop time that alu function does the calculation. You need to modify the bucketName to the name of the bucket where you stores "loopTime.txt". defaultKey is the default name of the file "loopTime.txt"
Make sure that you have installed and configured AWS sam-cli
- Create a bucket and upload loopTime.txt
- Modify the
bucketNameanddefaultKeyarguments inkeyDownloader.pyandtogether.py - Deploy the functions use sam-cli
sam build # First deploy sam deploy --guided
After deployed, you can see the functions at lambda console, and a step function at step-function console.
Use aws-cli to invoke TogetherFunction use the command below (don't forget to replace $YourFunctionArn):
aws lambda invoke --function-name $YourFunctionArn --payload file://events/aluEvent.json --cli-binary-format raw-in-base64-out response.jsonUse the step function (ResourceEfficientStateMachine) to run two functions (KeyDownloader, AluFunction) sequentially.
This workload refers to the helloworld project created by sam init command, which is licensed by Apache License 2.0