Windows服务,多线程 [英] Windows Service, Multi Threading
问题描述
大家好,
我需要一些有关如何应对收到的最新挑战的建议.
我需要创建一个Windows服务,该服务将安装在3台不同的服务器上.
此Windows服务将必须产生200个线程,每个线程将使用相同的存储过程使用唯一的过滤器查询相同的sql表(没有2个线程将具有相同的数据),并且每个线程都需要进行网络服务调用以将该数据发送到一个客户.向我们公开的客户端Web服务可以处理1000个同时连接.
你们认为我应该坚持传统的线程还是使用并行类?
你们是否知道我可以阅读以正确构建此架构的任何参考资料?
Hi Guys,
I need a bit of advice on how to tackle the latest challenge I have received.
I need to create a windows service that will be installed on 3 diffrent servers.
This windows service will have to spawn 200 threads, each thread will query the same sql tables with unique filters using the same stored procedure ( no 2 threads will have the same data) and each thread needs to make a webservice call to send that data to a Client. The client webservice that has been exposed to us can handle a 1000 simultaneous connections.
Do you guys think that I should stick to traditional threading or make use of the parallel classes?
Do you guys know of any refrence material I could read through to architect this correctly?
What are the pitfalls to look out for?
推荐答案
如果可以使用.Net 4.0,我建议使用任务并行库.萨莎·巴伯(Sacha Barber)在这方面有很多出色的文章. 此处 [ ^ ]是系列中的第一个.它使线程处理更加直观.
If you could do it with .Net 4.0 I would recommend using the Task Parallel Library. Sacha Barber has an excellent set of articles on this. Here[^] is the first in the series. It makes threading so much more intuitive.
这篇关于Windows服务,多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!