PDA

View Full Version : Multi-Threading Using VBP


joe12
05-26-2011, 06:08 PM
Specifically, one of the multithreading tasks I want to do is call out to SqlServer databases to run scripts against many databases at once.

I always have a bunch of new SQL scripts that must be run on hundreds of databases during our regular interval deployments.

To reduce deployment times, I need a way to thread pool this activity so that some number of DBs (maybe 20, more or less) are updated with selected SQL scripts concurrently. I don't want to simply kick off the scripts in a "loop without waiting" against all the databases, as I want to be able to throttle the thread pool dynamically based on script types.

If possible, I want to do the multi-thread work using VBP's GUI console implementation exclusively if possible, as currently I can simply use the "process files" and "run SQL" actions to upgrade the databases, which is very low maintenance, but doing it sequentially is now taking too long. I realize that multithreading will complicate my scripts but I want to mitigate as much complexity as possible.

Having the thread workers report back status is also a concern. And have them abort a particular database's upgrade if/when script output contains an error.


There may be several ways to do this, so looking for some options/opinions as we may in the future want to multithread other tasks from within VBP (like multiple node installs and "same-second" concurrent status feedbacks from multiple servers).


Thanks! :)

kinook
05-27-2011, 07:14 AM
You could use the parallel builds technique demonstrated in the Chain.bld sample for that (and possibly a variation on the SingleInstance.bld sample to throttle the # of simultaneous instances).
http://www.kinook.com/VisBuildPro/Manual/chainsample.htm
http://www.kinook.com/VisBuildPro/Manual/singleinstancesample.htm