简体   繁体   English

500个套接字客户端试图将数据推送到我的套接字服务器。 需要协助处理

[英]500 Socket clients trying to push data to my socket server. Need help in handling

I am required to create a high performance application where I will be getting 500 socket messages from my socket clients simultaneously. 我需要创建一个高性能应用程序,在该应用程序中,我将同时从套接字客户端获取500条套接字消息。 Based on my logs i could see that my dual core system is processing 80 messages at a time. 根据我的日志,我可以看到我的双核系统一次处理了80条消息。

I am using Async sockets (.BeginRecieve) and i have set NoDelay to true 我正在使用异步套接字(.BeginRecieve),并且我将NoDelay设置为true

From the logs from my clients and my server i could see that the message i wrote from my client is read by my server after 3-4 sec. 从我的客户端和服务器的日志中,我可以看到我的客户端写的消息在3-4秒后被服务器读取。

My service time of my application should be lot lesser. 我的应用程序的服务时间应该少得多。

Start looking at your resource usages: 开始查看您的资源使用情况:

  • CPU usage - both on the overall system, as well as your specific process. CPU使用率-整个系统以及您的特定进程都使用。
  • Memory usage - same as above. 内存使用情况-与上面相同。
  • Networking statistics. 网络统计。

Once you identify where the bottleneck is, both the community and yourself will have an easier time looking at what to focus on next in improving the performance. 一旦确定了瓶颈所在,社区和您自己都将有一个更轻松的时间来寻找下一个重点,以改善性能。

A review of your code may also be necessary - but this may be more appropriate for https://codereview.stackexchange.com/ . 可能还需要对代码进行审查-但这可能更适合https://codereview.stackexchange.com/

First, you should post your current code so any potential bugs can be identified. 首先,您应该发布当前代码,以便可以识别任何潜在的错误。

Second, if you're on .NET 3.5, you might want to look at the SocketAsyncEventArgs enhancements. 其次,如果您使用的是.NET 3.5,则可能需要查看SocketAsyncEventArgs的增强功能。

When you do a socket.listen , what is your backlog set to? 当您执行socket.listen时 ,您的待办事项设置为什么? I can't speak to .net 4.0, but with 2.0 I have seen a problem where once your backlog is filled up (too many connection attempts too fast) then some of the sockets will get a TCP accept and then a TCP Reset. 我无法使用.net 4.0进行交谈,但是使用2.0版时,我遇到了一个问题,即一旦您的待办事项被填满(太多的连接尝试太快),那么某些套接字将获得TCP接受,然后获得TCP重置。 The Client then may or may not attempt to reconnect later again. 然后,客户端可能会也可能不会尝试稍后再重新连接。 This causes a connection bottleneck rather than a data throughput or a processing bottleneck. 这将导致连接瓶颈,而不是数据吞吐量或处理瓶颈。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM