Every day, more and more cloud hosts clutter the web.
This leaves the big question largely unanswered:
Which one is right for you?
Usually this answer falls heavily on which cloud host offers the best performance.
Testing takes time and precious development hours.
Cloud-benchmark is a simple to use npm package to help developers determine which cloud
host is the fastest for their specific application.
General benchmarks are helpful, but with cloud-benchmark, developers can quickly
customize their very own benchmarks to test their node.js apps and all its quirks.
Follow the steps below to learn how to use cloud-benchmark.
Add cloud benchmark to your package.json file to maintain most uptodate version.
"cloud-benchmark" : "*"
var cb = require('cloud-benchmark');
After deploying your application on different cloud hosts, add the url of each host.
cb.insertCloud("http://ec2-54-186-73-1.us-west-2.compute.amazonaws.com");
cb.insertCloud("https://sleepy-shelf-49558.herokuapp.com/");
Add the routes of your nodejs application that you'd like to test. For POST requests, add the parameters.
cb.addRoute("GET", "/");
cb.addRoute("POST", "/addTodo", todo);
cb.addRoute("POST", "/deleteTodo", todo);
cb.addRoute("GET", "/getTodos");
The test will run every x number of hours, and perform y tests. cb.interval(x,y)
cb.interval(6, 4);
So, in this example, the benchmark will run every 6 hours and will undergo 4 intervals.
cb.number_of_trials = 100;
cb.startBenchmark();
Cloud-benchmark will automatically generate this for you once the benchmark is complete. Simply open report.js.