Multi-threading in Windows Service

Jan 8 2013 1:02 AM
 

I have created multithreading inside windows service. I have a timer inside the windows service so that every 5 minutes it will run the service. Inside the service, I have created 10 threads to do parallel task.

The Problems I am facing:

1. Sometimes the windows services become stop. I have to manually start it again. Why it happen and how to resolve it?

2. Instead of thread, if I create 10 windows service, then it is faster than 10 threads. So how can I do it with multi-threading?


I give you the exact scenario that I want to do So that it will be easy to get the real picture:


I have created an application to send message. I am receiving more message in every minute. I have to broadcast them as fast as possible.

Now currently I have created 30 windows services and each windows service broadcast the message. If do some changes, then I have to do in 30 windows services.  So, I have created one windows service which will create 30 threads and start broadcasting the message. But I see it's sending speed slower than my previous 30 windows service do.

So how can I resolve this problem?

Please help and advice.

Thanks in advance.


Answers (1)