North-Seattle-College / ad440-winter2021-tuesday-repo

NSC AD 440 Winter 2021 Tuesday cohort practicum repo
Apache License 2.0
4 stars 22 forks source link

Using Serverless Artillery 40 requests without cache /users/{userId}/tasks/{task_id} (NO PR) #341

Open RayWu222 opened 3 years ago

RayWu222 commented 3 years ago
Date Activity Time
03/20/2021 Research on Serverless Artillery and Serverless 5 hours
03/21/2021 Work on Serverkess Artillery without cache for /users/{userid}/tasks/{task_id} 5 hours
03/22/2021 Running test, troubleshooting, and documenting result 5 hours
RayWu222 commented 3 years ago

Steps to turn off cache:

  1. Go to Azure Portal
  2. Go to the resource group
  3. Go to Function
  4. Go to Configuration under Settings
  5. Click on CACHE_TOGGLE and set it to false, and press ok. Then press save

Running Serverless Artillery

Prerequisites

1. Node JS

You can install Node JS from https://nodejs.org/en/download/ or with your operating system’s package manager.

2. Serverless Framework CLI

To install globally use the following command. npm install -g serverless@1.38.0

you need to install serverless@1.38.0 to be compatible with serverless-artillery

3. Installing serverless-artillery

npm install -g serverless-artillery

To check that the installation succeeded, run: slsart --version

1. Setup AWS credentials

Create an AWS user, grab your credentials from a script, tool, and add them to the environment.

2. Create custom deployment assets

Create a local copy of the deployment assets for your customization and then deployment to AWS, using the following command. slsart configure

add region information to the serverless.yml file, for example region=us-west-2

3. Deploy

Go to the folder in your local directory containing script.yml file In the command line, run slsart deploy --stage <your-unique-stage-name> You can go to your AWS account console > CloudFormation, and see AWS stack - created there depending on the customizations explained in the steps above.

4. Invoke

run slsart invoke --stage <your-unique-stage-name> If you go to AWS Lambda console > find the loadGenerator Lambda corresponding to your stack > Monitoring tab > Invocations graph, you will see that the Lambda function was invoked to generate the load. You can also see the logs produced by the Lambda in CloudWatch Logs.

5. Remove

The following command will remove the AWS CloudFormation Stack deployed in step 3. slsart remove --stage <your-unique-stage-name>

RayWu222 commented 3 years ago
Screen Shot 2021-03-23 at 10 15 30 AM Screen Shot 2021-03-23 at 10 15 44 AM