Results 1 to 4 of 4

Thread: Threading questions

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Threading questions

    I have done multi threading before but has been a while and need to refresh my memory and the best practice to do the following:

    to process a high volume of input and output messages (messages would be placed in some form of queue and depending upon the type of message, it would request a certain "handler" to process that mesage. The "handler" would then place it into another processing queue for that type of message) - how would this be done and what would be the best way of doing this, making sure its scalable? What about making sure that this processing system is independant, more like an SOA/SAAS - should it be hosted as WCF? (I do think so but just curious, since there will be other "outsiders" consuming such a service)

    To add complexity, what about dealing with transactional data in terms of the database? Making sure that things are being processed once and not multiple times (thread racing I guess)? So I may wish to CRUD that message - want to make sure that it is not done x amount of times (yes I know, perhaps place a lock around it but I want to make sure there is far less chance of this always being the case due to performance and scalability reasons)

    Thanks

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Threading questions

    With regards to the threading specifically, sounds like a job for the ThreadPool and perhaps a ConcurrentQueue.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: Threading questions

    What does hosting it in WCF give you? It sounds like communication in and out of the process is done through messages, not procedure calls. In which case your message queues are the interface, not web methods. I would look into messaging frameworks like NServiceBus and MassTransit. These will handle the 'threading' bit for you a swell, just register the handlers for the message types and go for it (modulo configuring the engine, of course).

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    Re: Threading questions

    Thanks

    Re: Threading - yes, totally aware of the ThreadPool. I guess I want to make sure that anything is processed immediately as there would be literally hundreds/thousands of things to process (since the system is a high performance type application). As for the concurrentQueue.... interesting.

    Re: "Bus". Thanks. I am not sure if we will be using MSMQ, due to previous little experience where apperently some messages were just disappeared from the queue or something of that nature. Do not want any data to be lost at all but does need to be placed in some queue, waiting to be processed and to have the ability of listening to messages and sending messages.

    Again, not sure if this should be a WCF service or something else? Need to make sure that this business logic is independant of the applications surrounding this unit of business logic.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width