![]() ![]() This resulted in ab on fastify Result for 100 Requests ![]() Running fastify.js test: ab -n 100 -c 10 ab on fastify Code This resulted in: ab on express Result for 100 Requests Running express.js test: ab -n 100 -c 10 ab on express Code Now I need to test in a more realistic scenario, so I used " ab", the apache-benchmark tool to hit the API concurrently with requests.Īfter I got express and fastify running on port 30, respectively, I used the ab tool to examine the benchmarks for 100 requests with concurrency level 10, mimicking 10 current users. Then, I executed both files in two terminals: using node express.js for the code using express, and node fastify.js for the code using fastify. The code for express.js is: const express = require('express')()Įxpress.listen(port, () => console.log(`listening on port : `, port)) express.js Test CodeĪnd the code for fastify.js is: const fastify = require('fastify')()įastify.listen(port).then(()=> console.log('listening on port : ', port)) fastify.js Test Code ![]() To mimic a real scenario, I sent same json data in the response. They both contain a get request serving on the default route. I created the express.js and fastify.js files for testing purposes. npm install express fastify Installing Express and Fastify Then I installed and both of which are the latest version at the time of writing. Npm init Node Project Initialization Bash Script Setupįor the purpose of this speed test, I created a Node.js project with npm using: mkdir testProject The following test was conducted on a Macbook Air with the M1 chip and 8GBs of Unified Memory onboard. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |