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

NSC AD 440 Winter 2021 Thursday cohort practicum repo
Apache License 2.0
2 stars 27 forks source link

[Task] Using Serverless Artillery 40 requests with cache /users/{userId}/tasks/{task_id} #309

Open ahmadafrasiyab opened 3 years ago

ahmadafrasiyab commented 3 years ago

Is your feature request related to a problem? Please describe. This issue is for using serverless artillery framework to test the /users/{userId}/tasks/{task_id} endpoint with 40 requests with the cache option turned on.

Describe the solution you'd like Using VS code terminal to install serverless artillery and then test the given endpoint.

ahmadafrasiyab commented 3 years ago
Date Activity Time Spent
03/24/2021 Setting up issue 15 mins
03/24/2021 Researching server-less aritllery 1 hour
03/24/2021 troubleshooting installation bugs 30 mins
03/24/2021 deploying stack 10 mins
03/24/2021 running tests 5 mins
03/25/2021 creating task 5 mins
ahmadafrasiyab commented 3 years ago

Instructions

  1. Install serverless artillery using the following commands
    npm install -g serverless@1.38.0
    npm install -g serverless-artillery
  2. I used bash terminal to export my AWS access key and secret using the following commands:
export AWS_ACCESS_KEY_ID=***
export AWS_SECRET_ACCESS_KEY=*** 
  1. Use the following command to deploy the stack to AWS.

    slsart deploy --stage <stack name> --region <region>
  2. Edit the .yml file (or make your own for test purposes) in test/serverless-artillery and use duration as 300 and arrivalRate as 40

  3. If the stack is deployed successfully, use the following command to run your tests from the root of the thursday repo.

slsart invoke -p <path to your .yml file> --stage <stack name> --region <region> 

After this step, please go to the AWS console -> lambda -> your own lambda function -> monitor->logs and you can get the results (search for scenarios launched to locate them easily in the logs)

  1. Once done, delete the created stack using the below command.
slsart remove --stage <stack name>--region <region> 
ahmadafrasiyab commented 3 years ago

The results with the cache turned on are as follows;

Input with CACHE
Scenarios launched 900
Scenarios completed 815
Requests completed 815
RPS sent 5.01

Request latency min | 102.2 max | 120001 median | 77710.1 p95 | 111081.2 p99 | 117403.2 Scenario counts 0 | 900 (100%) Codes 200 | 815 Errors ESOCKETTIMEDOUT | 65 | 365