{"id":17449760,"url":"https://github.com/bolner/fastcgi-bench","last_synced_at":"2025-04-02T22:25:42.877Z","repository":{"id":148174525,"uuid":"174239139","full_name":"bolner/FastCGI-bench","owner":"bolner","description":"FastCGI Benchmark - NodeJS vs C#","archived":false,"fork":false,"pushed_at":"2019-03-17T19:40:21.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-08T12:46:58.741Z","etag":null,"topics":["async","benchmark","csharp","dotnet-core","fastcgi","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/bolner.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":"2019-03-06T23:55:58.000Z","updated_at":"2020-01-25T08:45:39.000Z","dependencies_parsed_at":"2023-11-20T18:15:11.840Z","dependency_job_id":null,"html_url":"https://github.com/bolner/FastCGI-bench","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/bolner%2FFastCGI-bench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolner%2FFastCGI-bench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolner%2FFastCGI-bench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bolner%2FFastCGI-bench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bolner","download_url":"https://codeload.github.com/bolner/FastCGI-bench/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246901447,"owners_count":20852219,"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":["async","benchmark","csharp","dotnet-core","fastcgi","nodejs"],"created_at":"2024-10-17T21:52:20.534Z","updated_at":"2025-04-02T22:25:42.861Z","avatar_url":"https://github.com/bolner.png","language":"Shell","readme":"# FastCGI-Bench - NodeJS vs .NET Core\n\nThe goal of this project is to demonstrate that a `.NET Core` web application can reach the performance of a `NodeJS` one if it uses only async techniques for handling input/output. Since I was unable to find a fully async FastCGI client library for .NET Core, I've developed one: [AsyncFastCGI.NET](https://github.com/bolner/AsyncFastCGI.NET).\n\nThese are the tested FastCGI libraries:\n\n| Project name | Github page | Framework | Language |\n| --- | --- | --- | --- |\n| AsyncFastCGI\u0026period;NET | https://github.com/bolner/AsyncFastCGI.NET | .NET Core | C# |\n| node-fastcgi | https://github.com/fbbdev/node-fastcgi| NodeJS | Javascript |\n| LukasBoersma/FastCGI | https://github.com/LukasBoersma/FastCGI | .NET Core | C# |\n\n## Benchmark results\n\nThe ApacheBench tool was used to measure the performance. As you can see, the non-async library fails during higher concurrency. All tests were run 10 times, and the best one (req/sec) was selected.\n\n### Concurrency: **20** simultanous connections / 20'000 requests\n\n        ab -c 20 -n 20000 127.0.0.1/PATH\n\n| Library          | Req. /sec | Req. Time | Conc. R.T. | Longest R. | Failed |\n|------------------|-----------|-----------|------------|------------|--------|\n| AsyncFastCGI.NET | 19494.64  | 1.026 ms  | 0.051 ms   | 18 ms      | 0      |\n| NodeJS           | 19453.72  | 1.028 ms  | 0.051 ms   | 13 ms      | 0      |\n| LB FastCGI       | 4249.07   | 4.707     | 0.235      | 3040 ms    | 0      |\n\n*Req. Time: mean | Conc. R.T.: mean, across all concurrent requests*\n\n### Concurrency: **400** simultaneous connections / 200'000 requests\n\n        ab -c 400 -n 200000 127.0.0.1/PATH\n\n| Library          | Req. /sec | Req. Time | Conc. R.T. | Longest R. | Failed |\n|------------------|-----------|-----------|------------|------------|--------|\n| AsyncFastCGI.NET | 19893.88  | 20.107 ms | 0.050 ms   | 2044 ms    | 0      |\n| NodeJS           | 21411.16  | 18.682 ms | 0.047 ms   | 1062 ms    | 0      |\n| LB FastCGI       | fails     | fails     | fails      | fails      | fails  |\n\n*Req. Time: mean | Conc. R.T.: mean, across all concurrent requests*\n\nConclusions:\n- The `.NET Core` applications can compete with the `NodeJS` ones regarding performance of I/O operations.\n- Using FastCGI clients can be an alternative to the traditional ways of implementing web applications for `.NET`, which force too many constraints on the developers. The later being the biggest reason for their unpopularity.\n\n## Installation\n\nA docker file is provided for setting up the test environment for comparing the performances of `NodeJS` and `.NET Core` FastCGI clients, using an Nginx webserver.\n\n- Create the docker image:\n\n        docker/build_image.sh\n\n- Create and start a container. The parameter is the public http port.\n\n        docker/create_container.sh 8080\n\n- Log in into the docker container:\n\n        docker/login.sh\n        or\n        docker/root_login.sh\n\n## Nginx config\n\n4 NodeJS and 2x4 C# processes accept FastCGI request on different ports.\n\n        upstream fastcgi_backend_asyncfcgi {\n                server 127.0.0.1:8080;\n                server 127.0.0.1:8081;\n                server 127.0.0.1:8082;\n                server 127.0.0.1:8083;\n        }\n\n        upstream fastcgi_backend_nodejs {\n                server 127.0.0.1:7070;\n                server 127.0.0.1:7071;\n                server 127.0.0.1:7072;\n                server 127.0.0.1:7073;\n        }\n\n        upstream fastcgi_backend_lbfastcgi {\n                server 127.0.0.1:9090;\n                server 127.0.0.1:9091;\n                server 127.0.0.1:9092;\n                server 127.0.0.1:9093;\n        }\n\n        server {\n                listen 80 default_server;\n                listen [::]:80 default_server;\n\n                root /var/www/html;\n                server_name _;\n\n                location / {\n                        try_files $uri $uri/ =404;\n                }\n\n                fastcgi_keep_conn off;\n                fastcgi_request_buffering off;\n\n                location /asyncfastcgi {\n                        include /etc/nginx/fastcgi_params;\n                        fastcgi_pass fastcgi_backend_asyncfcgi;\n                }\n\n                location /nodejs {\n                        include /etc/nginx/fastcgi_params;\n                        fastcgi_pass fastcgi_backend_nodejs;\n                }\n\n                location /lbfastcgi {\n                        include /etc/nginx/fastcgi_params;\n                        fastcgi_pass fastcgi_backend_lbfastcgi;\n                }\n        }\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbolner%2Ffastcgi-bench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbolner%2Ffastcgi-bench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbolner%2Ffastcgi-bench/lists"}