You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Daniel Pub <dc...@gmail.com> on 2014/08/15 17:10:18 UTC

HTTP Sampler + Javascript causes lock contention

Hi all,

During a load teste we've noticed that JMeter was presenting a response
time much bigger than the tested component. Taking some thread dumps we
found that on a total of 200 threads, 170 were locked at some javascript
object.

This was due to the usage of a JavaScript function in the body of the HTTP
payload. Do we really have to use a shared object for javascript and then
lock it causing this contention?

Bellow, my thread dump:


"Thread XXXX 1-200" prio=10 tid=0x00002aaab105e800 nid=0x34ec waiting for
monitor entry [0x000000005a3ff000]
   java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.jmeter.functions.JavaScript.execute(JavaScript.java:65)
- waiting to lock <0x000000070158e538> (a
org.apache.jmeter.functions.JavaScript)
at
org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:146)
at
org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:120)
at
org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:101)
at
org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:274)
at org.apache.jmeter.config.Argument.getValue(Argument.java:146)
at
org.apache.jmeter.protocol.http.util.HTTPArgument.getEncodedValue(HTTPArgument.java:199)
at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sendEntityData(HTTPHC4Impl.java:1168)
at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.handleMethod(HTTPHC4Impl.java:422)
at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:296)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1105)
at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1094)
at
org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
at java.lang.Thread.run(Thread.java:745)


Thanks,
Daniel

Re: HTTP Sampler + Javascript causes lock contention

Posted by Deepak Shetty <sh...@gmail.com>.
Not sure which ms you are referring to
${__time(yyyy-MM-dd hh:mm:ss.SSS)}  //date formatted with milliseconds
${__time(/1)} //milliseconds

regards
deepak


On Fri, Aug 15, 2014 at 1:56 PM, Daniel Pub <dc...@gmail.com> wrote:

> Hi Jeff
>
> No, we are using a function to get the timestamp in milis. From what I
> could see there's no built in function for that. The time function seems to
> only accept some patterns and none is the time in millis.
>
> Thanks
>
>
> 2014-08-15 16:44 GMT-03:00 Jeff Ohrstrom <jo...@hotmail.com>:
>
> > Yes unfortunately it does block on JavaScript. I'm not sure why that
> > approach was taken but there are workarounds. Are you by chance using
> > the javascript encode function?  They've given a JMeter Encode function
> > in 2.10 and up.
> >
> > My suggestion is avoid JavaScript and use a JSR223 Pre (or Post)
> > processor with Groovy and the appropriate cache size if you can't find a
> > JMeter built in function that's appropriate.
> >
> >
> > On Fri, 2014-08-15 at 12:10 -0300, Daniel Pub wrote:
> > > Hi all,
> > >
> > > During a load teste we've noticed that JMeter was presenting a response
> > > time much bigger than the tested component. Taking some thread dumps we
> > > found that on a total of 200 threads, 170 were locked at some
> javascript
> > > object.
> > >
> > > This was due to the usage of a JavaScript function in the body of the
> > HTTP
> > > payload. Do we really have to use a shared object for javascript and
> then
> > > lock it causing this contention?
> > >
> > > Bellow, my thread dump:
> > >
> > >
> > > "Thread XXXX 1-200" prio=10 tid=0x00002aaab105e800 nid=0x34ec waiting
> for
> > > monitor entry [0x000000005a3ff000]
> > >    java.lang.Thread.State: BLOCKED (on object monitor)
> > > at org.apache.jmeter.functions.JavaScript.execute(JavaScript.java:65)
> > > - waiting to lock <0x000000070158e538> (a
> > > org.apache.jmeter.functions.JavaScript)
> > > at
> > >
> >
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:146)
> > > at
> > >
> >
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:120)
> > > at
> > >
> >
> org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:101)
> > > at
> > >
> >
> org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:274)
> > > at org.apache.jmeter.config.Argument.getValue(Argument.java:146)
> > > at
> > >
> >
> org.apache.jmeter.protocol.http.util.HTTPArgument.getEncodedValue(HTTPArgument.java:199)
> > > at
> > >
> >
> org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sendEntityData(HTTPHC4Impl.java:1168)
> > > at
> > >
> >
> org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.handleMethod(HTTPHC4Impl.java:422)
> > > at
> > >
> >
> org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:296)
> > > at
> > >
> >
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
> > > at
> > >
> >
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1105)
> > > at
> > >
> >
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1094)
> > > at
> > >
> >
> org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429)
> > > at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
> > > at java.lang.Thread.run(Thread.java:745)
> > >
> > >
> > > Thanks,
> > > Daniel
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> > For additional commands, e-mail: user-help@jmeter.apache.org
> >
> >
>

Re: HTTP Sampler + Javascript causes lock contention

Posted by Daniel Pub <dc...@gmail.com>.
Hi Jeff

No, we are using a function to get the timestamp in milis. From what I
could see there's no built in function for that. The time function seems to
only accept some patterns and none is the time in millis.

Thanks


2014-08-15 16:44 GMT-03:00 Jeff Ohrstrom <jo...@hotmail.com>:

> Yes unfortunately it does block on JavaScript. I'm not sure why that
> approach was taken but there are workarounds. Are you by chance using
> the javascript encode function?  They've given a JMeter Encode function
> in 2.10 and up.
>
> My suggestion is avoid JavaScript and use a JSR223 Pre (or Post)
> processor with Groovy and the appropriate cache size if you can't find a
> JMeter built in function that's appropriate.
>
>
> On Fri, 2014-08-15 at 12:10 -0300, Daniel Pub wrote:
> > Hi all,
> >
> > During a load teste we've noticed that JMeter was presenting a response
> > time much bigger than the tested component. Taking some thread dumps we
> > found that on a total of 200 threads, 170 were locked at some javascript
> > object.
> >
> > This was due to the usage of a JavaScript function in the body of the
> HTTP
> > payload. Do we really have to use a shared object for javascript and then
> > lock it causing this contention?
> >
> > Bellow, my thread dump:
> >
> >
> > "Thread XXXX 1-200" prio=10 tid=0x00002aaab105e800 nid=0x34ec waiting for
> > monitor entry [0x000000005a3ff000]
> >    java.lang.Thread.State: BLOCKED (on object monitor)
> > at org.apache.jmeter.functions.JavaScript.execute(JavaScript.java:65)
> > - waiting to lock <0x000000070158e538> (a
> > org.apache.jmeter.functions.JavaScript)
> > at
> >
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:146)
> > at
> >
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:120)
> > at
> >
> org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:101)
> > at
> >
> org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:274)
> > at org.apache.jmeter.config.Argument.getValue(Argument.java:146)
> > at
> >
> org.apache.jmeter.protocol.http.util.HTTPArgument.getEncodedValue(HTTPArgument.java:199)
> > at
> >
> org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sendEntityData(HTTPHC4Impl.java:1168)
> > at
> >
> org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.handleMethod(HTTPHC4Impl.java:422)
> > at
> >
> org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:296)
> > at
> >
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
> > at
> >
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1105)
> > at
> >
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1094)
> > at
> >
> org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429)
> > at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
> > at java.lang.Thread.run(Thread.java:745)
> >
> >
> > Thanks,
> > Daniel
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: HTTP Sampler + Javascript causes lock contention

Posted by Jeff Ohrstrom <jo...@hotmail.com>.
Yes unfortunately it does block on JavaScript. I'm not sure why that
approach was taken but there are workarounds. Are you by chance using
the javascript encode function?  They've given a JMeter Encode function
in 2.10 and up. 

My suggestion is avoid JavaScript and use a JSR223 Pre (or Post)
processor with Groovy and the appropriate cache size if you can't find a
JMeter built in function that's appropriate.    
 

On Fri, 2014-08-15 at 12:10 -0300, Daniel Pub wrote:
> Hi all,
> 
> During a load teste we've noticed that JMeter was presenting a response
> time much bigger than the tested component. Taking some thread dumps we
> found that on a total of 200 threads, 170 were locked at some javascript
> object.
> 
> This was due to the usage of a JavaScript function in the body of the HTTP
> payload. Do we really have to use a shared object for javascript and then
> lock it causing this contention?
> 
> Bellow, my thread dump:
> 
> 
> "Thread XXXX 1-200" prio=10 tid=0x00002aaab105e800 nid=0x34ec waiting for
> monitor entry [0x000000005a3ff000]
>    java.lang.Thread.State: BLOCKED (on object monitor)
> at org.apache.jmeter.functions.JavaScript.execute(JavaScript.java:65)
> - waiting to lock <0x000000070158e538> (a
> org.apache.jmeter.functions.JavaScript)
> at
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:146)
> at
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:120)
> at
> org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:101)
> at
> org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:274)
> at org.apache.jmeter.config.Argument.getValue(Argument.java:146)
> at
> org.apache.jmeter.protocol.http.util.HTTPArgument.getEncodedValue(HTTPArgument.java:199)
> at
> org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sendEntityData(HTTPHC4Impl.java:1168)
> at
> org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.handleMethod(HTTPHC4Impl.java:422)
> at
> org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:296)
> at
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
> at
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1105)
> at
> org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1094)
> at
> org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429)
> at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
> at java.lang.Thread.run(Thread.java:745)
> 
> 
> Thanks,
> Daniel



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org