jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <philippe.moua...@gmail.com>
Subject Re: Use ThreadLocalRandom instead of Random
Date Mon, 21 Jan 2013 21:18:11 GMT
On Mon, Jan 21, 2013 at 10:03 PM, sebb <sebbaz@gmail.com> wrote:

> On 21 January 2013 20:56, Philippe Mouawad <philippe.mouawad@gmail.com>
> wrote:
> > On Mon, Jan 21, 2013 at 9:45 PM, sebb <sebbaz@gmail.com> wrote:
> >
> >> On 21 January 2013 20:27, Philippe Mouawad <philippe.mouawad@gmail.com>
> >> wrote:
> >> > Hello Sebb,
> >> > My answers below.
> >> >
> >> > Regards
> >> > Philippe
> >> >
> >> > On Mon, Jan 21, 2013 at 6:22 PM, sebb <sebbaz@gmail.com> wrote:
> >> >
> >> >> On 21 January 2013 12:28, Philippe Mouawad <
> philippe.mouawad@gmail.com>
> >> >> wrote:
> >> >> > Hello,
> >> >> > Java 7 introduced ThreadLocalRandom which has much better
> performances
> >> >> than
> >> >> > using Random as static instance.
> >> >> > See:
> >> >> >
> >> >> >
> >> >>
> >>
> http://docs.oracle.com/javase/tutorial/essential/concurrency/threadlocalrandom.html
> >> >> >
> >> >>
> >>
> http://niklasschlimm.blogspot.fr/2012/01/java-7-how-to-write-really-fast-java.html
> >> >> >
> >> >> >
> >> >> > Implementation is here for Java6 but can we use it with Apache
> >> License ?:
> >> >> >
> >> >>
> >>
> https://github.com/codahale/metrics/blob/master/metrics-core/src/main/java/com/yammer/metrics/stats/ThreadLocalRandom.java
> >> >>
> >> >> That appears to be public domain.
> >> >> Not sure of whether that is allowable or not.
> >> >>
> >> >> >
> >> >> > Or should we migrate to Java 7 as Java6 will be soon EOL ?
> >> >>
> >> >> Is the performance of Random a significant problem for JMeter?
> >> >> Does it affect all tests? Or just some test elements?
> >> >> If not, then I don't think it's worth the effort.
> >> >>
> >> >
> >> > I will affect:
> >> > - RandomVariableConfig
> >> > - RandomController
> >> > - RandomTimer
> >>
> >> Yes, but I doubt these are used frequently.
> >>
> >
> > I agree
> >
> >>
> >> > - RegexpExtractor => Used a lot
> >> > - HtmlExtractor => Hope it will be :-)
> >> > - __regexFunction
> >> > - AnchorModifier
> >>
> >> But is the random option used frequently?
> >>
> > Well I must say I use it on almost every Test Plan I did these last years
> > :-)
> >
> > If random is still called even if not selected, then that should be
> >> fixed anyway.
> >>
> > No that's OK, it is called only if 0 is selected.
> >
> >>
> >> > So maybe we could at least impact:
> >> > - RegexpExtractor => Used a lot
> >> > - HtmlExtractor => Hope it will be :-)
> >> > - RandomController
> >>
> >> Yes, but will speeding up calls to Random affect a test run by much?
> >>
> >
> > Well with high number of threads I think it begins impacting.
> >
>
> Well I doubt it.
>

Why ? I tend to trust Doug Lea and the blog I sent by a Java core
developer. Should we check this ? It takes time.

>
> >
> >> e.g. by how much does using random RE slow down a sample test compared
> >> with using a fixed RE?
> >> Is it really significant?
> >>
> >
> > I didn't test but in my opinion, whenever we can improve core parts we
> > should.
>
> Yes, but in this case there are side effects, so the potential
> improvement needs to be demonstrated.
>
> What are the side effects ? Can you clarify ?


> > As I am not sure it will cost us a lot.
> > But if you have some other fields to improve in mind, let's work on it.
> >
> > You still didn't answer to my mail on logging framework replacement ;-)
>
> Post a reminder to the thread.
>
> Done.

> >
> >
> >> >
> >> >>
> >> >> As to whether to require Java 7, I suspect Java 6 will still be used
> >> >> by many (especially businesses) until long after EOL (and remember
> >> >> users can pay to have longer support).
> >> >>
> >> >
> >> > I agree with you this policy applies for Application servers, but for
> >> tools
> >> > like JMeter I don't think it does. From my experience as a JMeter
> user,
> >> we
> >> > always were able to have a particular Java version installed.
> >>
> >> >>
> >> >> If a move to Java 7 would allow the use of new APIs that provide
> >> >> significant performance improvements then it might be worth doing.
> >> >> But we do need to be aware that requiring Java 7 as a minimum may
> well
> >> >> exclude some users.
> >> >>
> >> >
> >> > Same answer as before.
> >> > I think if we cannot use  ThreadLocalRandom as copy / paste in JMeter
> >> > source, it is worth thinking about moving to Java 7.
> >> > Who can help us on this license problem ?
> >> >
> >> >>
> >> >> > Regards
> >> >> > Philippe M.
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Cordialement.
> >> > Philippe Mouawad.
> >>
> >
> >
> >
> > --
> > Cordialement.
> > Philippe Mouawad.
>



-- 
Cordialement.
Philippe Mouawad.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message