Code Monkey home page Code Monkey logo

vs-webframework's Introduction

Install and build

git clone --depth 1 https://github.com/ditsmod/vs-webframework.git
cd vs-webframework
npm i
npm run build

All applications are built in ESM format, keepAliveTimeout: 5000 is set, and generation of additional headers is disabled.

Cold start

The shorter the cold-start time, the better the frameworks are suited for serverless technology. So, the results of a cold start are as follows:

framework result, ms
express v4.19 4
koa v2.15 4
restify v11.1 8
ditsmod v2.52 18
fastify v4.26 22
hapi v21.3 23
nest v10.3 + fastify 45
nest v10.3 + express 107

For now, this benchmark is run manually, for example:

node dist/ditsmod/main.mjs
# OR
node koa.mjs
# OR
node dist/nestjs/main-express.mjs
# ...

See package.json for more examples with start script.

Run benchmarks

npm start
ab -n 20000 -c 10 localhost:3000/hello
# OR
wrk -t1 -c10 -d5 -H 'Connection: close' http://localhost:3006/hello

Here you need manually changes port in the range from 3000 to 3007.

"Hello, World!" performance comparison for web frameworks:

  • Fastify
  • Ditsmod
  • Koa
  • Restify
  • Express
  • Nestjs + Express
  • Nestjs + Fastify
  • Hapi

req-per-sec-frameworks1.png

The following command will allow you to view the status of running programs:

npx pm2 l

If you run this command immediately after running the benchmark, in particular you will see how much memory each of the applications is consuming.

Interesting information is in the cpu and mem columns. Also in โ†บ column you can see number of restarting the applications.

In addition, you can also check the work of Ditsmod and NestJS with controllers that are created "per request". To do this, request for the path /hello2, for example:

wrk -t1 -c10 -d3 -H 'Connection: close' http://localhost:3006/hello2

Stop webservers

npm run stop

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.