1

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

Kappa
  • 1,015
  • 1
  • 16
  • 31
kirti
  • 40
  • 5
  • Is the data in your dictionary known in advance, or is it derived programmatically during your grinder run? Does your dictionary contain primitive or complex data types? – Travis Bear Oct 28 '13 at 23:00
  • Actually no. It is prepared on the run..!! That is creating the whole issue as is. – kirti Oct 29 '13 at 04:08

1 Answers1

3

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.

Travis Bear
  • 13,039
  • 7
  • 42
  • 51
  • Thank you Travis. The first part seems promising. I will check out the memcache or sqlite kind of storage structures. The second suggestion however is not feasible in my case as a unique data is being generated on the fly by the agents. – kirti Oct 30 '13 at 08:12