I have a BeanShell sampler that has an initialisation method that reads
a file into a data structure. Since a separate BeanShell interpreter is
created for each thread, this work is being repeated for every thread.
Two problems here:

- Wasted work -- the file only needs to be read once, and then the data
structure can be shared across threads.

- Synchronization -- If two threads try to read the file at the same
time, they might step on each other (since I use JMeter's FileServer).

I plan to do two things:

- Synchronise the routine that reads the file into the data structure so
it only happens once.

- Put the data structure into a JMeter variable so all threads can share
it.

And I have a couple of questions:

1. What should I synchronize on? I really want to synchronise on the
FileEntry object created by the FileServer, but I can't get hold of it.
I could synchronise on the FileServer itself but that's overkill. The
problem is that there's no way in BeanShell to create an appropriately
global, cross-thread object to synchronise on.

2. Are JMeter variables shared across threads?

I would appreciate your thoughts.

Thanks
Bennett.
--
Bennett McElwee

This communication, including any attachments, is confidential. If you are not 
the intended recipient, you should not read it - please contact me immediately, 
destroy it, and do not copy or use any part of this communication or disclose 
anything about it. Thank you. Please note that this communication does not 
designate an information system for the purposes of the Electronic Transactions 
Act 2002.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to