Skip to content
This repository has been archived by the owner on Jul 16, 2019. It is now read-only.

Commit

Permalink
Tweaks to allow testing of high volume small reqs and larger reqs too
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrencegripper committed Nov 17, 2017
1 parent a2fbd32 commit 07eaa28
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
19 changes: 17 additions & 2 deletions Demos/apps/loadtest/WebServicePkg/Code/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,28 @@ var http = require('http');
const PORT = process.env.NODE_PORT || 3000;
const RESPONSE = process.env.RES_STRING || "Hello World"

/**
* Returns a random integer between min (inclusive) and max (inclusive)
* Using Math.round() will give you a non-uniform distribution!
*/
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}


var server = http.createServer(function (req, res) {
var body = RESPONSE;
if (req.url.includes('large')) {
var body = JSON.stringify(new Array(getRandomInt(1000,2000000)));
} else {
var body = RESPONSE;
}
var content_length = body.length;
res.writeHead(200, {
'Content-Length': content_length,
'Content-Type': 'text/plain' });
res.end(body);
});
server.listen(PORT);
console.log('Server is running on port ' + PORT);
console.log('Server is running on port ' + PORT);


Empty file modified Testing/Cleanup.sh
100644 → 100755
Empty file.
5 changes: 4 additions & 1 deletion Testing/Scenario2/Setup.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ENDPOINT_TO_TEST=$1

#Traefik install
sfctl application upload --path ./Traefik/ApplicationPackageRoot/
sfctl application provision --application-type-build-path ApplicationPackageRoot
Expand All @@ -12,5 +14,6 @@ do
sfctl application create --app-type NodeAppType --app-version 1.0.0 --parameters "{\"PORT\":\"25$i\", \"RESPONSE\":\"25$i\"}" --app-name fabric:/node25$i ) &
done


#Run load test
docker run --rm -it williamyeh/wrk -c 100 -t6 -d15m $ENDPOINT_TO_TEST
docker run --rm -it williamyeh/wrk -c 100 -t6 -d15m $ENDPOINT_TO_TEST/large

0 comments on commit 07eaa28

Please sign in to comment.