What to do to make 50 concurrent calls to Flask app deployed on AWS? What to do to make 50 concurrent calls to Flask app deployed on AWS? flask flask

What to do to make 50 concurrent calls to Flask app deployed on AWS?


I recommend you try Bees With Machine Guns. Its a python script that will launch micro EC2 instances and send many requests from these instances to your application. This will simulate a large surge in traffic for performance testing.

I heard about it from AWS training videos on CBT Nuggets. The instructor was effective using it to trigger auto scaling and load test his configuration.

Good luck.


You could try our little tool k6 also: https://github.com/loadimpact/k6

You script the behaviour of the virtual users using JavaScript, so it is quite easy to get 50 different users logging in with different credentials. Would look something like this (this code is going to need debugging though :)

import http from "k6/http";let login_url = "http://ec2-instance-address.com/user/login";let get_new_site_url = "http://ec2-instance-address.com/license/getNewSite";let credentials = [    { "account": "Account1", "username": "joe", "password": "secret" },    { "account": "Account2", "username": "jane", "password": "verysecret" }];export default function() {  let session_id = doLogin();  let response = doGetNewSite(session_id);  let response_text = response["ResponseText"];  let new_site_id = response["NewSiteID"];  for (i = 0; i < loop_count; i++) {    // do heartbeat stuff?  }}function doLogin() {  let index = Math.floor(Math.random() * credentials.length);  let post_body = {    "AccountName": credentials[index]["account"],    "UserID": credentials[index]["username"],    "UserPassword": credentials[index]["password"]  };  let http_headers = { "Content-Type": "application/json" };  let res = http.post(login_url, JSON.stringify(post_body), { headers: http_headers });  check(res, {    "Response code is 200": (r) => r.status == 200,    "Login successful": (r) => JSON.parse(r.body).hasOwnProperty("SessionID")  });  return JSON.parse(res.body)["SessionID"];}function doGetNewSite(session_id) {  let http_headers = { "Content-Type": "application/json" };  let post_body = { "SessionID": session_id };  let res = http.post(get_new_site_url, JSON.strjngify(post_body), { headers: http_headers });  check(res, {    "Status code was 200": (r) => r.status == 200,    "Got response text": (r) => JSON.parse(r.body).hasOwnProperty("ResponseText"),    "Got new site id": (r) => JSON.parse(r.body).hasOwnProperty("NewSiteID")  });  return JSON.parse(res.body);}