Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Is it possible to access Global Variables across multiple virtual users?

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:

Transaction Tinit


If GetUserId()=1 then

GlobalVarSet ("Custom Counter", 10);


End Tinit;

BDF Script 2:

Transaction Tmain


GlobalVarGet ("Custom Counter", nCount);

End TMain;

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".

See also Resolution What is the difference between a variable declared in the upper var section of a BDF script, a Global variable, and a variable declared in a transaction?


Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 18:54
Updated by:
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.