Question

Here is the requirement :

  1. In simple words, I have a static dictionary(say dictionaryX) in a class (say ClassX in shared.py file) that needs to be shared across multiple agents and multiple processes in grinder.

How do I achieve this..?

Any help would be greatly appreciated. Thanks in advance

Was it helpful?

Solution

There are a couple of approaches you could take:

  • When your dictionary is calculated, store it to a common external location everyone can read. (e.g. zookeeper, a shared network drive, a database, etc.) Ideally this could happen somewhere in module-level code, so that it's not being done by each agent thread.

  • Generate the data deterministically in each agent, so that they independently generate identical dictionaries. You could then optionally have each agent/process only use a subset of the total data available, based on unique attributes such as the host name, thread number, etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top