{"id":21896850,"url":"https://github.com/ditsmod/vs-webframework","last_synced_at":"2025-04-15T17:49:12.464Z","repository":{"id":48192571,"uuid":"279400590","full_name":"ditsmod/vs-webframework","owner":"ditsmod","description":"Benchmark: fastify vs nestjs vs ditsmod vs restify vs hapi vs express","archived":false,"fork":false,"pushed_at":"2025-04-08T13:39:47.000Z","size":703,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T14:36:33.854Z","etag":null,"topics":["benchmark","ditsmod","express","fastify","hapi","nestjs","restify"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ditsmod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-13T20:05:31.000Z","updated_at":"2025-04-08T13:39:51.000Z","dependencies_parsed_at":"2024-04-08T06:27:59.346Z","dependency_job_id":"04b71538-8e91-46fd-8271-ecb308a550fc","html_url":"https://github.com/ditsmod/vs-webframework","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditsmod%2Fvs-webframework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditsmod%2Fvs-webframework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditsmod%2Fvs-webframework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditsmod%2Fvs-webframework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ditsmod","download_url":"https://codeload.github.com/ditsmod/vs-webframework/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249125253,"owners_count":21216701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","ditsmod","express","fastify","hapi","nestjs","restify"],"created_at":"2024-11-28T14:14:32.899Z","updated_at":"2025-04-15T17:49:12.457Z","avatar_url":"https://github.com/ditsmod.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Install and build\n\n```bash\ngit clone --depth 1 https://github.com/ditsmod/vs-webframework.git\ncd vs-webframework\nnpm i\nnpm run build\n```\n\nAll applications are built in ESM format, `keepAliveTimeout: 0` is set, and generation of additional headers is disabled.\n\n## Cold start\n\nThe shorter the cold-start time, the better the frameworks are suited for serverless technology. So, the results of a cold start are as follows:\n\n| framework            | result, ms    |\n|----------------------|:-------------:|\n| express v4.19        |  4            |\n| koa v2.15            |  4            |\n| restify v11.1        |  8            |\n| fastify v4.26        |  22           |\n| hapi v21.3           |  23           |\n| ditsmod v3.0         |  30           |\n| nest v10.3 + fastify |  45           |\n| nest v10.3 + express |  107          |\n\nFor now, this benchmark is run manually, for example:\n\n```bash\nnode dist/ditsmod/main.mjs\n# OR\nnode koa.mjs\n# OR\nnode dist/nestjs/main-express.mjs\n# ...\n```\n\nSee `package.json` for more examples with start script.\n\n## Run benchmarks\n\n```bash\nnpm start\nab -n 20000 -c 10 localhost:3000/hello\n# OR\nwrk -t1 -c10 -d5 -H 'Connection: close' http://localhost:3006/hello\n```\n\nHere you need manually changes port in the range from 3000 to 3007.\n\n\"Hello, World!\" performance comparison for web frameworks:\n\n- `Fastify`\n- `Ditsmod`\n- `Koa`\n- `Restify`\n- `Express`\n- `Nestjs + Express`\n- `Nestjs + Fastify`\n- `Hapi`\n\n![req-per-sec-frameworks1.png](req-per-sec-frameworks3.png)\n\nThe following command will allow you to view the status of running programs:\n\n```bash\nnpx pm2 l\n```\n\nIf you run this command immediately after running the benchmark, in particular you will see how much memory each of the applications is consuming.\n\nInteresting information is in the `cpu` and `mem` columns. Also in `↺` column you can see number of restarting the applications.\n\nIn 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:\n\n```bash\nwrk -t1 -c10 -d3 -H 'Connection: close' http://localhost:3006/hello2\n```\n\n## Stop webservers\n\n```bash\nnpm run stop\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fditsmod%2Fvs-webframework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fditsmod%2Fvs-webframework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fditsmod%2Fvs-webframework/lists"}