Is it possible to access Global Variables across multiple virtual users?
Yes, Global Variables are accessible for all users running on all agents, this means that all virtual users can access a global variable. You can have multiple BDF scripts / virtual users in SilkPerformer which set/call a Globalvariable e.g:
BDF Script 1:
If GetUserId()=1 then
GlobalVarSet ("Custom Counter", 10);
BDF Script 2:
GlobalVarGet ("Custom Counter", nCount);
Global variables should be used with care due to possible transaction synchronization issues i.e. if a transaction is executed out ofsync this can effect the output of a global variable. Also as there is anoverhead in maintaining global variables they need to be used with care in very large loadtests with multiple agents when resources may be a constraint.
Because multiple virtual users may try to access thesevariables at the same time it is good practice to limit the number that canupdate a global variable to one, this can be achieved using the GlobalResourceEnter function e.g.:
GlobalResourceEnter("update 1 at a time", 1);
GlobalVarSet("Custom Counter", 11);
GlobalResourceRelease("update 1 at a time");
There is a section in the SilkPerformer Help which describes at length the usage of Global Variables and synchronization, to view this section in SilkPerformer go to "HELP | CONTENTS | INDEX" and type"Process synchronization functions".