{"id":15097752,"url":"https://github.com/sombriks/node-vs-kotlin-k6-benchmark","last_synced_at":"2026-02-04T04:33:25.075Z","repository":{"id":226799974,"uuid":"769624151","full_name":"sombriks/node-vs-kotlin-k6-benchmark","owner":"sombriks","description":"Small benchmark using k6 tool","archived":false,"fork":false,"pushed_at":"2024-03-29T21:33:44.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T13:34:46.448Z","etag":null,"topics":["benchmarking","k6","koajs","kotlin","nodejs","spring"],"latest_commit_sha":null,"homepage":"https://sombriks.com/blog/0068-benchmark-with-k6/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sombriks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-03-09T15:48:31.000Z","updated_at":"2024-03-10T16:47:47.000Z","dependencies_parsed_at":"2024-03-14T14:40:38.325Z","dependency_job_id":"6b034427-dcf4-4926-9e6d-ffb3d02e4b9b","html_url":"https://github.com/sombriks/node-vs-kotlin-k6-benchmark","commit_stats":null,"previous_names":["sombriks/node-vs-kotlin-k6-benchmark"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sombriks/node-vs-kotlin-k6-benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fnode-vs-kotlin-k6-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fnode-vs-kotlin-k6-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fnode-vs-kotlin-k6-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fnode-vs-kotlin-k6-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sombriks","download_url":"https://codeload.github.com/sombriks/node-vs-kotlin-k6-benchmark/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sombriks%2Fnode-vs-kotlin-k6-benchmark/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262937111,"owners_count":23387515,"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":["benchmarking","k6","koajs","kotlin","nodejs","spring"],"created_at":"2024-09-25T16:40:22.219Z","updated_at":"2026-02-04T04:33:25.000Z","avatar_url":"https://github.com/sombriks.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [node-vs-kotlin-k6-benchmark][title]\n\nSmall benchmark using [k6][k6] tool. More details in [the article][article].\n\n## Requirements\n\n- node 20 or newer\n- java 17 / kotlin 1.9 or newer\n- k6 benchmarking tool\n\nFor this example we'll test two similar projects:\n\n- [sample-htmx-koa][koa]\n- [sample-htmx-javalin][javalin]\n\nThis one was added later:\n\n- [sample-htmx-spring][spring]\n\nAnd this one:\n\n- [sample-htmx-chi (go)][go-chi]\n\n## How to run\n\n- install [k6][k6]\n\nRun [one of][koa] [the services][javalin] then run one of the scripts:\n\n```bash\nk6s run benchmark-javalin.js\n```\n\nOr:\n\n```bash\nk6s run benchmark-koa.js\n```\n\n## How to check results\n\n- see [output options][k6-options] for k6\n\n## Benchmark Hardware\n\n```bash\n[sombriks@thanatos ~]()$ inxi --cpu --memory --disk\nMemory:\n  System RAM: total: 48 GiB available: 45.88 GiB used: 7.1 GiB (15.5%)\n  Array-1: capacity: 64 GiB slots: 2 modules: 2 EC: None\n  Device-1: Channel-A DIMM 0 type: DDR4 size: 16 GiB speed: 3200 MT/s\n  Device-2: Channel-B DIMM 0 type: DDR4 size: 32 GiB speed: 3200 MT/s\nCPU:\n  Info: 8-core model: AMD Ryzen 7 PRO 5850U with Radeon Graphics bits: 64\n    type: MT MCP cache: L2: 4 MiB\n  Speed (MHz): avg: 773 min/max: 400/4507 cores: 1: 400 2: 400 3: 400\n    4: 1397 5: 400 6: 1397 7: 1397 8: 1397 9: 400 10: 400 11: 1396 12: 400\n    13: 400 14: 400 15: 1397 16: 400\nDrives:\n  Local Storage: total: 931.51 GiB used: 410.4 GiB (44.1%)\n  ID-1: /dev/nvme0n1 vendor: Kingston model: SFYRS1000G size: 931.51 GiB\n\n```\n\n## Sample results\n\nFor javalin:\n\n```bash\n[sombriks@thanatos node-vs-kotlin-k6-benchmark](main)$ k6 run benchmark-javalin.js \n\n          /\\      |‾‾| /‾‾/   /‾‾/   \n     /\\  /  \\     |  |/  /   /  /    \n    /  \\/    \\    |     (   /   ‾‾\\  \n   /          \\   |  |\\  \\ |  (‾)  | \n  / __________ \\  |__| \\__\\ \\_____/ .io\n\n     execution: local\n        script: benchmark-javalin.js\n        output: -\n\n     scenarios: (100.00%) 1 scenario, 10 max VUs, 1m0s max duration (incl. graceful stop):\n              * default: 10 looping VUs for 30s (gracefulStop: 30s)\n\n\n     ✓ 200 ok\n\n     checks.........................: 100.00% ✓ 145571      ✗ 0     \n     data_received..................: 963 MB  32 MB/s\n     data_sent......................: 12 MB   388 kB/s\n     http_req_blocked...............: avg=3.62µs  min=1.2µs    med=3.07µs  max=4.7ms    p(90)=4.03µs  p(95)=4.85µs \n     http_req_connecting............: avg=19ns    min=0s       med=0s      max=413.19µs p(90)=0s      p(95)=0s     \n     http_req_duration..............: avg=1.92ms  min=792.12µs med=1.37ms  max=457.43ms p(90)=2.61ms  p(95)=4.12ms \n       { expected_response:true }...: avg=1.92ms  min=792.12µs med=1.37ms  max=457.43ms p(90)=2.61ms  p(95)=4.12ms \n     http_req_failed................: 0.00%   ✓ 0           ✗ 145571\n     http_req_receiving.............: avg=61.05µs min=21.55µs  med=48.06µs max=11.76ms  p(90)=70.17µs p(95)=89.09µs\n     http_req_sending...............: avg=15.87µs min=5.85µs   med=12.94µs max=13.1ms   p(90)=18.07µs p(95)=23.24µs\n     http_req_tls_handshaking.......: avg=0s      min=0s       med=0s      max=0s       p(90)=0s      p(95)=0s     \n     http_req_waiting...............: avg=1.85ms  min=730.46µs med=1.3ms   max=457.21ms p(90)=2.5ms   p(95)=3.97ms \n     http_reqs......................: 145571  4852.059693/s\n     iteration_duration.............: avg=2.04ms  min=883.69µs med=1.47ms  max=459.31ms p(90)=2.76ms  p(95)=4.31ms \n     iterations.....................: 145571  4852.059693/s\n     vus............................: 10      min=10        max=10  \n     vus_max........................: 10      min=10        max=10  \n\n\nrunning (0m30.0s), 00/10 VUs, 145571 complete and 0 interrupted iterations\ndefault ✓ [======================================] 10 VUs  30s\n```\n\nFor koa:\n\n```bash\n[sombriks@thanatos node-vs-kotlin-k6-benchmark](main)$ k6 run benchmark-koa.js \n\n          /\\      |‾‾| /‾‾/   /‾‾/   \n     /\\  /  \\     |  |/  /   /  /    \n    /  \\/    \\    |     (   /   ‾‾\\  \n   /          \\   |  |\\  \\ |  (‾)  | \n  / __________ \\  |__| \\__\\ \\_____/ .io\n\n     execution: local\n        script: benchmark-koa.js\n        output: -\n\n     scenarios: (100.00%) 1 scenario, 10 max VUs, 1m0s max duration (incl. graceful stop):\n              * default: 10 looping VUs for 30s (gracefulStop: 30s)\n\n\n     ✓ 200 ok\n\n     checks.........................: 100.00% ✓ 30714       ✗ 0    \n     data_received..................: 24 MB   796 kB/s\n     data_sent......................: 2.5 MB  82 kB/s\n     http_req_blocked...............: avg=3µs     min=951ns  med=1.87µs  max=1.49ms   p(90)=4.3µs   p(95)=5.98µs \n     http_req_connecting............: avg=109ns   min=0s     med=0s      max=484.61µs p(90)=0s      p(95)=0s     \n     http_req_duration..............: avg=9.66ms  min=6.24ms med=8.06ms  max=43.6ms   p(90)=17.26ms p(95)=20.75ms\n       { expected_response:true }...: avg=9.66ms  min=6.24ms med=8.06ms  max=43.6ms   p(90)=17.26ms p(95)=20.75ms\n     http_req_failed................: 0.00%   ✓ 0           ✗ 30714\n     http_req_receiving.............: avg=38.01µs min=16.7µs med=31.87µs max=376.28µs p(90)=59.85µs p(95)=71.37µs\n     http_req_sending...............: avg=11.7µs  min=4.47µs med=8.37µs  max=338.14µs p(90)=20.47µs p(95)=27.15µs\n     http_req_tls_handshaking.......: avg=0s      min=0s     med=0s      max=0s       p(90)=0s      p(95)=0s     \n     http_req_waiting...............: avg=9.61ms  min=6.21ms med=8.02ms  max=43.19ms  p(90)=17.16ms p(95)=20.65ms\n     http_reqs......................: 30714   1023.584482/s\n     iteration_duration.............: avg=9.75ms  min=6.3ms  med=8.14ms  max=45.35ms  p(90)=17.41ms p(95)=20.93ms\n     iterations.....................: 30714   1023.584482/s\n     vus............................: 10      min=10        max=10 \n     vus_max........................: 10      min=10        max=10 \n\n\nrunning (0m30.0s), 00/10 VUs, 30714 complete and 0 interrupted iterations\ndefault ✓ [======================================] 10 VUs  30s\n```\n\nWhile node/koa ran **30714 iterations**, java/javalin ran **145571 iterations**.\n\nJava outperformed Node in **470%** (approximated value).\n\nBoth delivered 100% success for 10 concurrent virtual users during 30 seconds.\n\n## Further reading\n\n- Study ways to improve node performance using [clusters][node-cluster].\n- Increase workload until the failure point in each benchmark.\n\n[title]: https://github.com/sombriks/node-vs-kotlin-k6-benchmark\n[article]: https://sombriks.com/blog/0068-benchmark-with-k6/\n[koa]: https://github.com/sombriks/sample-htmx-koa\n[javalin]: https://github.com/sombriks/sample-htmx-javalin\n[spring]: https://github.com/sombriks/sample-htmx-spring\n[k6]: https://grafana.com/docs/k6/latest/get-started/installation/#fedoracentos\n[k6-options]: https://grafana.com/docs/k6/latest/results-output/end-of-test/\n[node-cluster]: https://nodejs.org/api/cluster.html#cluster\n[go-chi]: https://github.com/sombriks/sample-htmx-chi\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsombriks%2Fnode-vs-kotlin-k6-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsombriks%2Fnode-vs-kotlin-k6-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsombriks%2Fnode-vs-kotlin-k6-benchmark/lists"}