Hydra is a high-performance, multi-channel TCP server written on C#. It is designed to handle a massive number of concurrent client connections—tested successfully with up to 50,000 simultaneous clients. Its key feature is the ability to manage multiple listening sockets (server sockets) within a single server instance, making it a true multi-channel communication hub.
- Massive Scalability: Efficiently handles tens of thousands of concurrent TCP client connections.
- Multi-Channel Architecture: Supports creating and managing multiple independent server endpoints (sockets) from a single server process.
- High Performance: Built with
asynchronous I/Oand optimized for minimal resource consumption under heavy load. - Reliability: Designed for stability, ensuring continuous operation even with a large number of connected clients.
- **Allows to protect channel with
TLS(X509certificates) for preventing data from being captured by sniffer
Example starting TCP-server without TLS:
// 1. Create Server cofifuration
ServerChannelConfiguration mainInsecureChannel = new ServerChannelConfiguration()
{
IpAddress = "127.0.0.1",
Port = 23456,
IsSecure = false
};
ITcpServer server = new MultiChannelTcpServer(new[] { mainInsecureChannel }, new NullLoggerFactory(), null, null);
// Example Echo server with data reverse
server.AssignHandler( async (d, c) =>
{
string msg = System.Text.Encoding.Default.GetString(d);
return d.Reverse().ToArray();
});
OperationResult startResult = await server.StartAsync();
// ...
OperationResult stopResult = await server.StopAsync();Hydra has been load-tested to handle up to 50000 concurrent client connections across its channels. Performance metrics depend on hardware, network configuration, and the workload (e.g., message frequency, size). Tests could be running in a Docker container as follows:
- Build docker container -
docker build -t hydra.tests -f .\test.Dockerfile . - Run tests
docker run -i -t hydra.tests
- Add Multicahnnel
UDP - Make server that allow to combine
TCPandUDP - Measure performance values with
50000of clients
Contributions are welcome! Please feel free to submit a Pull Request:
- Fork the repository.
- Create your feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
Wissance.Hydra contributors