0
votes

So JMeter's Beanshell Sampler has the option to "Reset before each call." In JMeter's documentation, it mentions that "This may be necessary for some long running scripts." Is there any reason that you wouldn't want to do this? It's set to false, so I assume there would be, but I haven't found anything on this.

1

1 Answers

0
votes

From Beanshell Scripting overview:

Each BeanShell test element has its own copy of the interpreter (for each thread). If the test element is repeatedly called, e.g. within a loop, then the interpreter is retained between invocations unless the "Reset bsh.Interpreter before each call" option is selected

Some long-running tests may cause the interpreter to use lots of memory; if this is the case try using the reset option.

So in general:

  • If your Beanshell script is doing something "light" - you shouldn't need to worry about resetting the interpreter
  • If your script does some "heavy" operations, calculations or being used as a primary load generator I would recommend to reconsider the sampler choice and start using JSR223 Sampler and Groovy language instead. Given proper configuration and following best practices JSR223 and groovy combination will provide almost as good performance as pure Java code does. See Beanshell vs JSR223 vs Java JMeter Scripting: The Performance-Off You've Been Waiting For! guide for more detailed explanation, instructions on enabling groovy engine, do's and dont's, and performance comparison of extension engines.