diff --git a/install.sh b/install.sh index e5b7bc5..c32dcf7 100644 --- a/install.sh +++ b/install.sh @@ -2,6 +2,7 @@ apt-get install apache2-utils apt-get install npm npm install n -g n latest +npm install restocat npm install hapi npm install express npm install restify diff --git a/restocat/collections/index/collection.json b/restocat/collections/index/collection.json new file mode 100644 index 0000000..67a6ae4 --- /dev/null +++ b/restocat/collections/index/collection.json @@ -0,0 +1,9 @@ +{ + "name": "index", + "logic": "index.js", + "endpointsDefault": false, + "endpoints": { + "get /": "list", + "get /keep-alive": "alive" + } +} \ No newline at end of file diff --git a/restocat/collections/index/index.js b/restocat/collections/index/index.js new file mode 100644 index 0000000..fcafdb5 --- /dev/null +++ b/restocat/collections/index/index.js @@ -0,0 +1,12 @@ +class Index { + list() { + this.$context.response.setHeader('Connection', 'close'); + return 'Hello world'; + } + + alive() { + return 'Hello world'; + } +} + +module.exports = Index; \ No newline at end of file diff --git a/restocat/restocat.js b/restocat/restocat.js new file mode 100644 index 0000000..8aa6c5d --- /dev/null +++ b/restocat/restocat.js @@ -0,0 +1,13 @@ +const Restocat = require('restocat'); +const rest = new Restocat({ + collectionsGlob: [ + 'restocat/collections/**/collection.json' + ] +}); + +rest.locator.registerInstance('definedRoutes', {index: '/'}); + +rest.createServer().listen(8000) + .then(() => console.log('Restocat listen on 8000')) + .catch(reason => console.error(reason)); + diff --git a/run.sh b/run.sh old mode 100644 new mode 100755 index c8124c4..38ef7d2 --- a/run.sh +++ b/run.sh @@ -1,36 +1,42 @@ +echo restocat >> results.txt ; +node restocat/restocat.js & sleep 5 ; +ab -k -n 50000 -c 100 -t 20 http://127.0.0.1:8000/ | grep "Requests per second:" >> results.txt ; +pkill -f restocat ; +sleep 5 + echo express >> results.txt ; -node expressserver.js & sleep 5 ; +node expressserver.js & sleep 5 ; ab -k -n 50000 -c 100 -t 20 http://127.0.0.1:8000/ | grep "Requests per second:" >> results.txt ; pkill -f expressserver ; -sleep 5 +sleep 5 echo hapi >> results.txt ; node hapiserver.js & sleep 5 ; ab -k -n 50000 -c 100 -t 20 http://127.0.0.1:8000/ | grep "Requests per second:" >> results.txt ; pkill -f hapiserver ; -sleep 5 +sleep 5 echo node >> results.txt ; -node rawnodeserver.js & sleep 5 ; +node rawnodeserver.js & sleep 5 ; ab -k -n 50000 -c 100 -t 20 http://127.0.0.1:8000/ | grep "Requests per second:" >> results.txt ; pkill -f rawnodeserver ; -sleep 5 +sleep 5 echo restify >> results.txt ; -node restifyserver.js & sleep 5 ; +node restifyserver.js & sleep 5 ; ab -k -n 50000 -c 100 -t 20 http://127.0.0.1:8000/ | grep "Requests per second:" >> results.txt ; pkill -f restifyserver ; -sleep 5 +sleep 5 echo koa2 >> results.txt ; -node koa2server.js & sleep 5 ; +node koa2server.js & sleep 5 ; ab -k -n 50000 -c 100 -t 20 http://127.0.0.1:8000/ | grep "Requests per second:" >> results.txt ; pkill -f koa2server ; -sleep 5 +sleep 5 echo total.js >> results.txt ; -node totalserver/total.js & sleep 5 ; +node totalserver/total.js & sleep 5 ; ab -k -n 50000 -c 100 -t 20 http://127.0.0.1:8000/ | grep "Requests per second:" >> results.txt ; pkill -f total ; sleep 5 ; @@ -38,15 +44,15 @@ sleep 5 ; echo sails.js >> results.txt ; cd test-project ; sails lift & sleep 5 ; -cd ..; +cd ..; ab -k -n 50000 -c 100 -t 20 http://127.0.0.1:1337/ | grep "Requests per second:" >> results.txt ; pkill -f sails ; -sleep 5 +sleep 5 echo adonis.js >> results.txt ; cd yardstick ; npm start run & sleep 5 ; -cd ..; +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 \ No newline at end of file