Performance Tuning Microsoft Azure SQL Database

Play Performance Tuning Microsoft Azure SQL Database

The Discussion

  • User profile image

    Woah. Major no-no in here. Do not use Parallel.ForEach to run a query across each of the shards. Parallel.For and ForEach will use a thread per core on the machine and then inject a new thread only on detection of a blocked thread, once per second.

    It is NOT a convenient way to spawn, say, 10 tasks to run on 10 shards. You are not issuing those queries all at once.

    To genuinely issue all the queries at once (and you should), you must "manually" create and run 10 Task instances for each shard, stick them all in a collection and wait on them all.

Add Your 2 Cents