{"id":19991006,"url":"https://github.com/redhat-developer/kestrel-linux-transport","last_synced_at":"2025-05-04T10:30:58.357Z","repository":{"id":70800762,"uuid":"91091112","full_name":"redhat-developer/kestrel-linux-transport","owner":"redhat-developer","description":"Linux Transport for Kestrel","archived":true,"fork":false,"pushed_at":"2021-08-25T09:03:34.000Z","size":408,"stargazers_count":122,"open_issues_count":0,"forks_count":11,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-30T14:35:43.342Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/redhat-developer.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,"publiccode":null,"codemeta":null}},"created_at":"2017-05-12T12:50:52.000Z","updated_at":"2025-01-26T08:28:40.000Z","dependencies_parsed_at":"2023-09-10T02:04:36.391Z","dependency_job_id":null,"html_url":"https://github.com/redhat-developer/kestrel-linux-transport","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer%2Fkestrel-linux-transport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer%2Fkestrel-linux-transport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer%2Fkestrel-linux-transport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redhat-developer%2Fkestrel-linux-transport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redhat-developer","download_url":"https://codeload.github.com/redhat-developer/kestrel-linux-transport/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252320065,"owners_count":21729058,"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":[],"created_at":"2024-11-13T04:51:34.748Z","updated_at":"2025-05-04T10:30:58.351Z","avatar_url":"https://github.com/redhat-developer.png","language":"C#","readme":"**This code is no longer maintained, and won't be updated for new versions of .NET.**\n\n# Introduction\n\nThe ASP.NET Core Kestrel webserver has been using libuv as a cross-platform network library.\nIt is possible to replace libuv with another implementation thanks to the `Transport` abstraction.\n\nIn this repo we explore creating a Transport for Linux specifically.\n\n# Using the package\n\nAdd the myget feed to your `NuGet.Config` file:\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cconfiguration\u003e\n  \u003cpackageSources\u003e\n    \u003cadd key=\"rh\" value=\"https://www.myget.org/F/redhat-dotnet/api/v3/index.json\" /\u003e\n  \u003c/packageSources\u003e\n\u003c/configuration\u003e\n```\n\nInclude a package reference in your project `csproj` file:\n```xml\n  \u003cItemGroup\u003e\n    \u003cPackageReference Include=\"RedHat.AspNetCore.Server.Kestrel.Transport.Linux\" Version=\"3.1.0-*\" /\u003e\n  \u003c/ItemGroup\u003e\n```\n\nCall `UseLinuxTransport` when creating the `WebHost` in your `Program.cs`:\n```C#\npublic static IWebHost BuildWebHost(string[] args) =\u003e\n            Host.CreateDefaultBuilder(args)\n                .ConfigureWebHostDefaults(webBuilder =\u003e\n                {\n                    webBuilder\n                        .UseLinuxTransport()\n                        .UseStartup\u003cStartup\u003e();\n                });\n```\n\n**note**: It's safe to call `UseLinuxTransport` on non-Linux platforms, it will no-op.\n\n# Repo structure\n\nThere are 5 projects in this repository:\n- src/RedHat.AspNetCore.Server.Kestrel.Transport.Linux: managed library implementing Transport\n- samples/KestrelSample: Kestrel app for [benchmarking](Benchmark.md)\n- test/RedHat.AspNetCore.Server.Kestrel.Transport.Linux.Test: xunit test projects, has access to internals of managed library\n- test/RedHat.AspNetCore.Server.Kestrel.Transport.Linux.TestApp: empty application to use during development, has access to internals of managed library\n\nThe library can be packaged by running the `dotnet pack` on src/RedHat.AspNetCore.Server.Kestrel.Transport.Linux.\n```\n$ dotnet pack src/RedHat.AspNetCore.Server.Kestrel.Transport.Linux --configuration Release\n```\n\nTo build the library and run the tests execute `dotnet test` on test/RedHat.AspNetCore.Server.Kestrel.Transport.Linux.Test.\n```\n$ dotnet test test/RedHat.AspNetCore.Server.Kestrel.Transport.Linux.Test\n```\n\n# Design\n\nSimilar to other implementations, this library makes use of the non-blocking socket and epoll. Like the corefx\nSocket implementation, the eventloop is implemented in managed (C#) code. This is different from the libuv loop which\nis part of the native libuv library.\n\nThis library does not provide a generic xplat network API. It uses the kernel primitives directly to implement the\nTransport API. This reduces the number of heap allocated objects (e.g. `uv_buf_t`, `SocketAsyncEventArgs`), which means\nthere is less GC pressure. Implementations building on top of an xplat API will pool objects to achieve this.\n\nThe implementation starts a number of threads that each accept connections. This is based on [`SO_REUSEPORT`](https://lwn.net/Articles/542629/)\nsocket option. This option allow multiple sockets to concurrently bind and listen to the same port. The kernel performs\nload-balancing between the listen sockets.\n\nThe Transport has these options:\n\n- **DeferSend**: This defers sends to the Transport Thread which increases chances for multiple sends to coalesce. This options\ndefaults to true.\n\n- **ThreadCount**: Specifies the number of Transport Threads. This defaults to the number of logical processors in the system, maxed to 16.\n\n- **AioSend/AioReceive**: Uses Linux AIO system calls to batch send and receive calls. AioSend implies DeferSend. These options default to true.\n","funding_links":[],"categories":["C\\#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-developer%2Fkestrel-linux-transport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredhat-developer%2Fkestrel-linux-transport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredhat-developer%2Fkestrel-linux-transport/lists"}