多少线程?网络编程设计.NET [英] how many threads? network programming design .NET
问题描述
嗨
我用.NET编程多线程异步服务器
我的设计只是在每次接受后创建一个阅读线程。
并在服务器发送数据时创建写入线程。
您能否与我分享您在网络编程方面的经验和
多线程。
Hi
I am programming a multi-threaded asyncronous server with .NET
But when systems thread count reaches to 1350 system can''t respond.
Simply my design is creating a Reading Thread after every Accept.
And creating a Writing Thread when server sends data.
Can you share your experience with me on Network Programming and
Multi-Threading.
推荐答案
Parahat Melayev< pa ***** @ momenttech.com>写道:
Parahat Melayev <pa*****@momenttech.com> wrote:
我正在使用.NET编写多线程异步服务器
但是当系统线程数达到1350时,系统无法响应。
<简单地说,我的设计是在每次接受后创建一个阅读线程。
当服务器发送数据时创建一个写线程。
你可以在网络编程和我分享你的经验吗? />多线程。
I am programming a multi-threaded asyncronous server with .NET
But when systems thread count reaches to 1350 system can''t respond.
Simply my design is creating a Reading Thread after every Accept.
And creating a Writing Thread when server sends data.
Can you share your experience with me on Network Programming and
Multi-Threading.
而不是为每个网络连接创建两个线程,使用
异步调用(BeginRead等),以便你最终只能得到一些
的线程,而不是主动阻止
网络访问的线程。
-
Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet
如果回复小组,请不要给我发邮件
Rather than create two threads for every network connection, use the
asynchronous calls (BeginRead etc) so that you only end up with a few
threads at a time, rather than loads of threads actively blocking on
network access.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Parahat Melaye v写道:
Parahat Melayev wrote:
我正在使用.NET编写一个多线程异步服务器
但是当系统线程数达到1350时系统无法响应。
I am programming a multi-threaded asyncronous server with .NET
But when systems thread count reaches to 1350 system can''t respond.
系统上运行的线程越多,产生的比率越低,时间与CPU的上下文切换时间相比。一个好的服务器应用程序
一次只运行有限数量的线程快速服务一些
请求要好得多,非常缓慢地服务大量的
请求。
考虑使用I / O完成端口和/或线程池来管理
。请参阅
http://msdn.microsoft.com/library/de...completion.asp
-
Patrick Philippot - 微软MVP
MainSoft咨询服务
www .mainsoft.fr
另见
http://msdn.microsoft.com/library/?u ... asp?frame = true
请注意,
..Net中没有对I / O完成端口的直接支持。然而,他们在一些课程内部得到支持。
-
Patrick Philippot - 微软MVP
MainSoft咨询服务
www.mainsoft.fr
See also
http://msdn.microsoft.com/library/?u...asp?frame=true
Please note that there''s no direct support for I/O Completion ports in
..Net. However, they''re supported internally by some classes.
--
Patrick Philippot - Microsoft MVP
MainSoft Consulting Services
www.mainsoft.fr
>
这篇关于多少线程?网络编程设计.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!