J
Jeff L.
I'll try to keep this short and sweet...
I have a message queue that holds data received from multiple clients.
For each message in the queue, I need to do some processing that
involves communicating with a web service and then dump the data into
a SQL server table. Also, all work is done within an MSMQ transaction
so that the message stays in the queue if something goes wrong (can't
communicate with SQL or something, for example). So:
1. Begin MSMQ transaction.
2. Pull message.
3. Parse data object.
4. Pull additional info from web service.
5. Run stored proc to insert data into SQL server.
6. End MSMQ transaction.
The problem I'm having is that the data can possibly come in faster
than I can process it. It's not super time critical, but if it loads
up it will become a serious problem. The current process takes about
300ms to complete.
I tried creating a pool of threads (not ThreadPool...don't want to go
there due to past issues with WebRequest/WebResponse). This did not
work...it seemed like the more threads I created, the slower the
process became (2 threads = 700ms, 10 threads = 3000ms, 25 threads =
9000ms).
Any suggestions as to how I can have multiple threads/objects working
from the same message queue while still utilizing transactions? Maybe
I just need a fresh brain to set me straight on this issue.
Thanks for any help you can offer!
I have a message queue that holds data received from multiple clients.
For each message in the queue, I need to do some processing that
involves communicating with a web service and then dump the data into
a SQL server table. Also, all work is done within an MSMQ transaction
so that the message stays in the queue if something goes wrong (can't
communicate with SQL or something, for example). So:
1. Begin MSMQ transaction.
2. Pull message.
3. Parse data object.
4. Pull additional info from web service.
5. Run stored proc to insert data into SQL server.
6. End MSMQ transaction.
The problem I'm having is that the data can possibly come in faster
than I can process it. It's not super time critical, but if it loads
up it will become a serious problem. The current process takes about
300ms to complete.
I tried creating a pool of threads (not ThreadPool...don't want to go
there due to past issues with WebRequest/WebResponse). This did not
work...it seemed like the more threads I created, the slower the
process became (2 threads = 700ms, 10 threads = 3000ms, 25 threads =
9000ms).
Any suggestions as to how I can have multiple threads/objects working
from the same message queue while still utilizing transactions? Maybe
I just need a fresh brain to set me straight on this issue.
Thanks for any help you can offer!