Windows服务,多线程

编程入门 行业动态 更新时间:2024-10-25 08:16:02
本文介绍了Windows服务,多线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我需要一些有关如何应对收到的最新挑战的建议. 我需要创建一个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服务,多线程

本文发布于:2023-11-06 22:49:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564886.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多线程   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!