Note that there are some explanatory texts on larger screens.

plurals
  1. POPreventing Duplicates when using Parallel Processing on a ToDo List
    primarykey
    data
    text
    <p>I have, for example, a todo list, represented as a rows in a database with a 'IsComplete' field.</p> <p>At the end of each hour, I want to find all the todos not marked as complete, and send a reminder to their individual creators.</p> <p>There are millions of todos created each hour, and sending a reminder is an expensive process.</p> <p>I have single a worker role which will happily run each hour to get these incomplete todos, and add each one to a service bus queue to be picked up by a separate group of worker roles which deal with the expensive task of sending the reminders.</p> <p>The problems faced in this scenario are:</p> <ol> <li>If the single worker might fail, resulting in no todos being added to the queue for processing.</li> <li>Running multiple instances of the worker role, will result in duplicates as each instance competes with each other to add the todos to the que.</li> <li>Even if the queue rejects those duplicates, the database is subject to being queried for the same data multiple times by each instance, even if those todos have been processed and added to the reminders que.</li> <li>Even if the worker role scanned the database to see if the todos have had reminders created, again, if they happen to check at the same time, it's possible for more than one role to believe the todo needs a reminder.</li> <li>Scanning the database for todos is also expensive because there are so many, the worker roles can't divide this work load between them.</li> </ol> <p>What patterns are there that can solve or avoid this sort of concurrency issue? Is having multiple roles scan the same tables the draw back for the protection offered by running multiple roles in the first place?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload