diff --git a/expressserver.js b/expressserver.js index 025ab55..7c57ed5 100644 --- a/expressserver.js +++ b/expressserver.js @@ -2,7 +2,7 @@ var express = require('express'); var app = express(); app.get('/', function (req, res) { - res.set('Connection', 'close'); + res.set('Connection', 'close'); res.send('Hello World!'); }); diff --git a/fastifyserver.js b/fastifyserver.js new file mode 100644 index 0000000..8b4c74f --- /dev/null +++ b/fastifyserver.js @@ -0,0 +1,15 @@ +const fastify = require('fastify'); + +let app = fastify(); + +app.get('/', (req, reply) => { + reply + .header('Content-Type', 'text/plain') + .header('Connection', 'close') + .send('Hello world!'); +}); + +app.listen(process.env.PORT || 3000, err => { + if (err) throw err; + console.log(`server listening on ${ app.server.address().port }`); +}); diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index e5b7bc5..77745e8 --- a/install.sh +++ b/install.sh @@ -7,6 +7,7 @@ npm install express npm install restify npm install koa npm install koa2 +npm install fastify npm install n npm install total.js npm install adonis-cli -g @@ -16,4 +17,4 @@ cp yardstick-changes/app/Http/routes.js yardstick/app/Http/routes.js npm install sails -g sails new test-project cp test-project-changes/api/controllers/ApiController.js test-project/api/controllers/ApiController.js -cp test-project-changes/config/routes.js test-project/config/routes.js \ No newline at end of file +cp test-project-changes/config/routes.js test-project/config/routes.js diff --git a/run.sh b/run.sh old mode 100644 new mode 100755 index c8124c4..ce5d33b --- a/run.sh +++ b/run.sh @@ -28,6 +28,11 @@ ab -k -n 50000 -c 100 -t 20 http://127.0.0.1:8000/ | grep "Requests per second:" pkill -f koa2server ; sleep 5 +echo fastify >> results.txt ; +node fastifyserver.js & sleep 5 ; +ab -k -n 50000 -c 100 -t 20 http://127.0.0.1:3000/ | grep "Requests per second:" >> results.txt ; +pkill -f fastify; +sleep 5 echo total.js >> results.txt ; node totalserver/total.js & sleep 5 ; @@ -45,8 +50,10 @@ sleep 5 echo adonis.js >> results.txt ; cd yardstick ; -npm start run & sleep 5 ; +npm run serve & sleep 5 ; cd ..; ab -k -n 50000 -c 100 -t 20 http://127.0.0.1:3333/ | grep "Requests per second:" >> results.txt ; pkill -f server.js ; -sleep 5 \ No newline at end of file +sleep 5 + +