Re: Parallel Programming
- From: "Michel Posseth [MCP]" <MSDN@xxxxxxxxxxx>
- Date: Thu, 9 Oct 2008 21:59:38 +0200
Hey that program sounds familiair :-)
I have created a program that does exactly what you describe and a bit more
only with that difference that mine is always running in paralel modus
my program is a service by itself ( a windows service ) it checks every 500
miliseconds + N processing seconds if there is anny work to be done ,
if there is work availlable it will create a instance of a worker assembly
( dll with queue interface ) in a seperate thread .
1. Would the parallel processing library be appropriate for thisDon`t know i created the logic all myself , and it was not that hard + the
situation?
extra benefit is that i fully understand what is happening and have full
control
Could web services be invoked on each "thread" created and processed?Yes as IIS is also multithreaded and webservices are stateless
2. How would I make sure not to access the same record in the
database? I can return a listing of all the queueID's from the
database and pass them in as a parameter (looking a the Parallel.For
or Parallel.Foreach?
My queue table has a status byte so 0 is in wait modus , 1 is in process
modus , 2 is in cancell modus , 3 is in error state , 4 is finished
however the record is then also removed from the table
3. If this is not a good path to pursue, what other options do you
suggest? I was thinking of threading and calling the services on an
async method, but this has its own issues.
Yes i guess it is , in our production environment it is working this way
since early 2006 the project is recently upgraded to VB 2008 framework 3.5
I was thinking of threading and calling the services on an
async method, but this has its own issues.
I run my worker objects in a seperate thread als code is encapsulated in a
worker class that implements my queue interface it can comunicate with my
main assembly although it is running in a fire and forget modus on a
seperate thread context , my queue server can run multiple queues
simultaniously
this requires a good interface definition hoever it means that you can write
all your worker code in a "normall" fashion as the whole running object is
in a seperate running thread context .
In my opinion you are on the right path , as it sounds so familiair to
my project i would be a fool to say otherwise ( maybe my boss is reading
this :-) )
are you sure you are not also working for the ista corporation
http://www.ista.com :-)
However so many people so many aproaches for the same task so maybe someone
else has a brighter idea to acomplish this task
HTH
Michel Posseth [MCP]
http://www.vbdotnetcoder.com
"John" <riley_wright@xxxxxxxxxxx> schreef in bericht
news:e3be0c3e-e339-49c8-9980-cef127594c61@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a program that needs to run on a regular basis that looks at a
queue table in my database. If there are items in the queue database
I need to grab the data from the database and pass it to a web service
to process. The web service will return either a completion code or
error msg (the only errors expected would be timeout or cannot
connection errors). This queue file can contain 0 to N messages.
Naturally if there are no messages the program terminates. If there
are less than 8 messages in the queue, I will run the program on a
single thread waiting for a response. However, if there are more than
8 messages (indicating a backlog) I would like to process them in
parallel through the server's 8 cores. I have been reading up on the
parallel library and it looks promising. My questions are:
1. Would the parallel processing library be appropriate for this
situation? Could web services be invoked on each "thread" created and
processed?
2. How would I make sure not to access the same record in the
database? I can return a listing of all the queueID's from the
database and pass them in as a parameter (looking a the Parallel.For
or Parallel.Foreach?
3. If this is not a good path to pursue, what other options do you
suggest? I was thinking of threading and calling the services on an
async method, but this has its own issues.
Thanks.
John
.
- Follow-Ups:
- Re: Parallel Programming
- From: John
- Re: Parallel Programming
- References:
- Parallel Programming
- From: John
- Parallel Programming
- Prev by Date: Re: Remove Framework 3.5 dependency
- Next by Date: custom date formatting
- Previous by thread: Parallel Programming
- Next by thread: Re: Parallel Programming
- Index(es):
Relevant Pages
|