![]() ![]() This is the command I used for each API: wrk -t12 -c400 -d10s 12 is the number of threads we use, 400 the number of concurrent connections. On Linux, it can be installed with sudo apt-get install wrk. On macOS, it can be installed with brew install wrk. But because of the HTTP-versions, there are problems with Fastify and AB is very old anyway. ![]() In the last article, I used apache bench. I simply executed the APIs with the node command, no PM2 or nodemon was used. Each server was tested individually, all other request sources except the load-testing tool were switched off. I made sure that the same conditions prevailed in all tests. The Benchmarkįor the benchmark, I use the MacBook Pro 13 inch 2018, with the 4-core Intel i5 processor. With Express and Fastfiy, this was automatically in the header. For the content-type I had to specify utf-8 manually. Without the if-statement this node server would answer every request. I added the if-statement to make it fair - after all, the other two APIs check the route when requesting. But this does equate to 720 megs a day and 21 gigs a month if you're downloading a 10 meg file, so plan accordingly.Comments: In bare Node.js there is no res.send. I have node client setup in crontab to run every 10 minutes, with an ODDS_OF_RUNNING of 0.5, which means I'm actually only calculating my speed 3 times per hour. Run node client and the test will be executed.Run npm install to grab the few required packages.REMOTE_API_KEY - A loose security measure where an addition API-KEY is sent in the HTTP header to limit data loggingĪfter you have the environment variables defined,.REMOTE_SERVER - URL where the server will send a POST that contains machine, datetime, and a JSON stringified value of the results called data.LOCAL_HISTORY - Full path to a writable file where a JSON file will be created that stores the metrics of each run.For example 0.2 would run the script 20% of the attempts, and 1 would run the application every time (the default behavior) ODDS_OF_RUNNING - A number, 0 through 1, that represents the percent of time the application should run.MACHINE_NAME - The name of the machine running the bandwidth test (useful if you have multiple devices reporting to a remote server).I find a 10 meg file to be great ( a couple great options are listed here) TARGET_FILE - This is the URL of the large file to be downloaded.PING_REMOTE - This is the server that should be pinged to measure latency. ![]() env file in the same directory as the client.js file.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |