Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve networking performance #96

Open
Seb-stian opened this issue Apr 22, 2021 · 4 comments
Open

Improve networking performance #96

Seb-stian opened this issue Apr 22, 2021 · 4 comments
Assignees
Labels
future This feature will be worked on in the future priority: medium Moderately important server Relates to the server implementation

Comments

@Seb-stian
Copy link
Member

Networking can be made a lot faster and more clients can be handled. The idea is to use SocketAsyncEventArgs, pure TCP Socket and a custom lightweight buffered stream.

Resources:
https://github.com/chronoxor/NetCoreServer/blob/master/source/NetCoreServer/TcpServer.cs
https://www.codeproject.com/articles/83102/c-socketasynceventargs-high-performance-socket-cod
https://docs.microsoft.com/en-us/dotnet/api/system.net.sockets.socketasynceventargs?view=net-5.0#examples
https://github.com/ObsidianMC/Obsidian/blob/experimental/Obsidian/Net/NetWriteStream.cs

Assigning myself for now

@Seb-stian Seb-stian added future This feature will be worked on in the future server Relates to the server implementation labels Apr 22, 2021
@Seb-stian Seb-stian self-assigned this Apr 22, 2021
@Seb-stian
Copy link
Member Author

Note to self: keep an eye on dotnet/runtime#49941 (.NET 7?)

@Naamloos Naamloos added the priority: medium Moderately important label Jan 9, 2022
@TheVeryStarlk
Copy link
Contributor

I highly recommend checking out Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets as it already offers performant socket connections and listeners. It is used in ASP.NET Core so it must be 🚀

@ktalap
Copy link

ktalap commented Aug 8, 2023

I don't think there is much difference between TcpListener and Sockets. TcpListener uses Sockets underneath it. https://www.codeproject.com/Articles/5270779/High-Performance-TCP-Client-Server-using-TCPListen
After all the only thing we need is to accept series of bytes comming over network, the only thing we might be limited by is the serialization and deserialization of packets. Unless something in the source code was implemented incorrectly.

@TheVeryStarlk
Copy link
Contributor

I still think just using Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets is a better option, instead of going into the hassle of the needy greedy details of performant socket implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future This feature will be worked on in the future priority: medium Moderately important server Relates to the server implementation
Projects
Status: Backlog
Development

No branches or pull requests

4 participants