{"id":18266133,"url":"https://github.com/arturmareknowak/dotnetgorustbenchmark","last_synced_at":"2026-04-11T19:35:11.932Z","repository":{"id":232049266,"uuid":"780064129","full_name":"ArturMarekNowak/DotnetGoRustBenchmark","owner":"ArturMarekNowak","description":"The same REST API implemented in Go, .NET and Rust and benchmarked with k6","archived":false,"fork":false,"pushed_at":"2024-04-07T15:11:12.000Z","size":666,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T20:40:07.676Z","etag":null,"topics":["docker","dotnet","go","k6","mognodb","rust"],"latest_commit_sha":null,"homepage":"","language":"C#","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/ArturMarekNowak.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-31T15:48:24.000Z","updated_at":"2024-04-07T15:12:12.000Z","dependencies_parsed_at":"2024-04-07T17:36:58.349Z","dependency_job_id":null,"html_url":"https://github.com/ArturMarekNowak/DotnetGoRustBenchmark","commit_stats":null,"previous_names":["arturmareknowak/dotnetgorustbenchmark"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArturMarekNowak%2FDotnetGoRustBenchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArturMarekNowak%2FDotnetGoRustBenchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArturMarekNowak%2FDotnetGoRustBenchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArturMarekNowak%2FDotnetGoRustBenchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArturMarekNowak","download_url":"https://codeload.github.com/ArturMarekNowak/DotnetGoRustBenchmark/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247958722,"owners_count":21024829,"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":["docker","dotnet","go","k6","mognodb","rust"],"created_at":"2024-11-05T11:22:06.884Z","updated_at":"2025-12-30T23:05:44.479Z","avatar_url":"https://github.com/ArturMarekNowak.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DotnetGoRustBenchmark\n[![CodeFactor](https://www.codefactor.io/repository/github/arturmareknowak/dotnetgorustbenchmark/badge)](https://www.codefactor.io/repository/github/arturmareknowak/dotnetgorustbenchmark)\n\nI have wanted to step into the shoes of a QA engineer so I decided to implement the same contract in three different technologies and run a simple benchmark\n\n## Table of contents\n* [General info](#general-info)\n* [Benchmark](#benchmark)\n* [Technologies](#technologies)\n* [Setup](#setup)\n* [Status](#status)\n* [Inspiration](#inspiration)\n\n## General info\n\nI have built three simple application which all implement the same contract which is:\n\n```\ncurl -X GET -H \"Content-Type: application/json\" http://localhost:8080/helloWorld\n```\n\nresponds with\n\n```\n{\n    \"message\": \"Hello world!\"\n}\n```\n\nThe same response is for ports 8081 and 8082. And also second endpoint which retrieves simple user from MongoDb database:\n\n```\ncurl -X GET -H \"Content-Type: application/json\" http://localhost:8080/users/1\n```\n\nand the response is \n\n```\n{\n    \"Id\": 1,\n    \"Name\": \"Arthur\",\n    \"Surname\": \"Morgan\",\n    \"Email\": \"ArthurMorgan@mail.com\"\n}\n```\n\nFor ports 8081 and 8082 response slightly differs, but its only a difference in casing. Overall the project looks like this:\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"./docs/network.drawio.png\"/\u003e\n\u003cp align=\"center\"\u003ePic.1 Visualization of docker compose containers\u003c/p\u003e\n\n## Benchmark\n\nSmall disclaimer: I really recommend to take those benchmarks with more than a grain of salt and not to jump to any conclusions - I was curious what would be the result but at the end of the day those benchmarks are really closer to toy examples rather than to production grade stress test. I intentionally don't provide any comment about the results\n\nOnce the project was finished I wrote simple tests with k6. All three containers got limit of 1 CPU and 512MB of RAM limit in docker compose. MongoDB was not limited. Specification of the physical machine: \n\n- CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz\n- RAM: 24GB\n- OS: Windows 10 Home\n\nAfter the docker compose was up and running tests were run one by one in order: \n\n1. Go API - endpoint `GET /helloWorld`\n2. .NET API - endpoint `GET /helloWorld`\n3. Rust API - endpoint `GET /helloWorld`\n4. Go API - endpoint `GET /users/1`\n5. .NET API - endpoint `GET /users/1`\n6. Rust API - endpoint `GET /users/1`\n\nBelow I am presenting the results of `http_req_duration` metric. Benchmark was started with command:\n\n`k6 run --summary-trend-stats \"min,avg,med,max,p(50),p(95),p(99)\" .\\script.js`\n\nEndpoint `GET /helloWorld` has been tested with 100 preallocated virtual users, at rate 100 with duration of 10s:\n\n|      | min [ms] | avg [ms] | med [ms] | max [ms] | p(50) [ms] | p(95) [ms] | p(99) [ms] |\n|------| -------- | -------- | -------- | -------- | ---------- | ---------- | ---------- |\n| Go   | 0,511    | 1,78     | 1,46     | 46,23    | 1,46       | 2,92       | 5,41       |\n| .NET | 0,511    | 3,13     | 1,85     | 110,38   | 1,85       | 4,72       | 48,26      |\n| Rust | 1,05     | 2,64     | 2,05     | 84,04    | 2,05       | 4,42       | 9,33       |\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"./docs/GEThelloWorld.png\"/\u003e\n\u003cp align=\"center\"\u003ePic.2 Visualization of the data on a chart\u003c/p\u003e\n\nEndpoint `GET /users/1` has been tested with 100 preallocated virtual users, at rate 10 with duration of 10s:\n\n|      | min [ms] | avg [ms] | med [ms] | max [ms] | p(50) [ms] | p(95) [ms] | p(99) [ms] |\n|------| -------- | -------- | -------- | -------- | ---------- | ---------- | ---------- |\n| Go   | 25,55    | 32,55    | 30,39    | 46,71    | 30,39      | 42,4       | 45,55      |\n| .NET | 7,71     | 46,42    | 11,46    | 724,33   | 11,46      | 310,26     | 680,92     |\n| Rust | 19,16    | 33,78    | 26,82    | 267,57   | 26,82      | 48         | 187,92     |\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"./docs/GETusers1.png\"/\u003e\n\u003cp align=\"center\"\u003ePic.3 Visualization of the data on a chart\u003c/p\u003e\n\n\n## Technologies\n* .NET 8\n* Go 1.22\n* Rust 1.74\n* MongoDb\n* Docker\n* k6 0.50.0\n\n## Setup\n1. Run docker compose in src folder: `docker-compose up`\n2. APIs should be accessible from http://localhost:8080, http://localhost:8081 and http://localhost:8082\n\n## Status\nProject is: _finished_\n\n## Inspiration\nCause coding is fun","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farturmareknowak%2Fdotnetgorustbenchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farturmareknowak%2Fdotnetgorustbenchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farturmareknowak%2Fdotnetgorustbenchmark/lists"}