Skip to content

Serial Killer

Compare
Choose a tag to compare
@spaghettidba spaghettidba released this 08 Oct 09:20
· 78 commits to master since this release

SqlWorkload can now replay workloads in Serial mode: all the events can be executed on a single thread.
This is particularly useful when replaying a workload to catpure regressions in migration projects: you're not really interested in mimicking the source workload closely, but all that you want is that all queries are run against the target SQL Server, so that you can capture the execution plans with Query Store and the execution statistics with WorkloadTools.
The property that controls this behavior is ReplayConsumer.ThreadingMode and it accepts 4 possible values:

  • 1 - ThreadPools
  • 2 - Tasks
  • 3 - WorkerTask
  • 4 - Serial

The default is 3 (WorkerTask), but you can use the other multithreaded implementations if you prefer, even if they are not as stable as the WorkerTask. If you want to use a single threaded implementation you can use 4 (Serial).

This makes sense when working with a FileWorkloadListener, but it makes no sense when working with the other listeners, especially for a real-time replay. You also probalby want to disable SynchronizationMode in the file listener.

Example:

{
    "Controller": {

        "Listener":
        {
            "__type": "FileWorkloadListener",
            "Source": "c:\\temp\\capture.sqlite",
            "SynchronizationMode": false // you probably want to disable synchronization mode in this case
        },

        "Consumers":
        [
            {
                "__type": "ReplayConsumer",
                "ConnectionInfo": 
                {
                    "ServerName": "(local)",
                    "DatabaseName": "test"
                },
                "ThreadingMode": 4 // Serial synchronization
            }
        ]
    }
}