使用 TPL 在非常密集的应用程序中将异步套接字变成并行而不只是并发
我正在编写一个使用 Socket 的应用程序,这将非常密集,然后我真的需要使用我们大型服务器中的每个核心。我看到问题( 如何使用 ThreadPool 并行运行套接字线程?)在 stackoverflow 中只有一个答案指向此 MSDN 示例。
但我认为它只指出如何使其并发而不是并行,这里有人问CPU 密集程度如何打开套接字,它看起来非常密集,这里有人告诉它没有帮助 TPL TaskFactory.FromAsync 与具有阻塞方法的任务 和有人教如何在这里使用 TaskFactory.FromAsync (是否有包装现有 BeginXXX/EndXXX 的模式异步 方法到异步任务中?)。
如何保持套接字操作并行和高性能以及如果处理套接字 在正常的异步方式中,断开连接、半连接套接字和消息边界等问题是令人头疼的问题。如果把TPL和Task放在一起怎么处理。
I'm writing an application that uses Socket and it will be very intensive then I really need use every core we have in our big server. I see the question ( how to using ThreadPool to run socket thread parallel? ) here in stackoverflow there is only one answer that point to this MSDN Sample.
But I think it point only how to make it Concurrent and not Parallel, here is someone asking How cpu intensive is opening a socket and its looks be very intensive, someone here tell its dont help TPL TaskFactory.FromAsync vs Tasks with blocking methods and someone teach how to do it here whith TaskFactory.FromAsync (Is there a pattern for wrapping existing BeginXXX/EndXXX async
methods into async tasks?).
How can I keep socket operations parallel and performant and if deal whith socket
problems like disconnections, half connected sockets and message boundaries are a headache in normal async way. How to deal with it if its put together TPL and Task.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看到:
see that:
请参阅有关 TPL 和传统 .NET 异步编程 的链接,它没有回答但也许可以帮助你。有关于异步编程模型(APM)和基于事件的异步模式(EAP)的信息
See this link about TPL and Traditional .NET Asynchronous Programming, it dont answer but maybe can help you. There is information about Asynchronous Programming Model (APM) and Event-based asynchronous pattern (EAP)