Testing blocking chains - need to simulate a Chain of Blocking SPIDs for test.

  • I am testing certain queries to trace blocking chains during the running transactions.

    Does anyone know/have a certain simple test script/few queries that will simulate a CHAIN of SPIDs blocking one another?

    Likes to play Chess

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • Usually you need a couple of scripts. One to do the blocking, one to simulated the blocked.

    The easy way for the first script is have  aproc that has a WAITFOR in it. Or just open a transaction that requires an exclusive lock in a query window and start that.

    For simulating blocked users, a script to query the object locked is used, and then some START commands. This explains a bit: https://www.sqlservercentral.com/articles/executing-multiple-threads-to-create-a-load

    You can also use SQLQuery Stress, with a call to the locked object and lots of threads.

    https://github.com/ErikEJ/SqlQueryStress

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply