Return-Path: X-Original-To: apmail-jmeter-dev-archive@minotaur.apache.org Delivered-To: apmail-jmeter-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 97EAEDEE5 for ; Mon, 21 Jan 2013 22:07:04 +0000 (UTC) Received: (qmail 82040 invoked by uid 500); 21 Jan 2013 22:07:04 -0000 Delivered-To: apmail-jmeter-dev-archive@jmeter.apache.org Received: (qmail 81992 invoked by uid 500); 21 Jan 2013 22:07:04 -0000 Mailing-List: contact dev-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jmeter.apache.org Delivered-To: mailing list dev@jmeter.apache.org Received: (qmail 81982 invoked by uid 99); 21 Jan 2013 22:07:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jan 2013 22:07:04 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of philippe.mouawad@gmail.com designates 209.85.223.180 as permitted sender) Received: from [209.85.223.180] (HELO mail-ie0-f180.google.com) (209.85.223.180) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jan 2013 22:06:58 +0000 Received: by mail-ie0-f180.google.com with SMTP id c10so10842842ieb.11 for ; Mon, 21 Jan 2013 14:06:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=hyWS3nFwRU7UWoTX6/kIAYugSO+IPOW3cMr+5eIU3HA=; b=MvZpJ0MC1OyO/hhQGlBp3FHBK9LhdSdj/SauUucLcv+U674f+reNh8dn6kvHnlwAZ2 UoJI2yq9QPsKzaBYL1U72aQX+GsFpnYk++SAFrTCFzpPblTn8WproueqQuvtxYlVfIrf NhQ2/Ku/WGoJE0gv1yjjILO/86S0zvUokGeIRwPNBYzmS4+MpxACp0vzN9zBp3DpqXok ZjeJ4rtdGGAoWcvdBS4s38Adcs6Ysw071+8RxJ4Fhd/ZmtJs58g6VN60XobbX8oOecrP gw/0PrblwurxZQqf5HPAIBS9cRZAPPdlmd/xNcJm/RDjFil4Kz75z7BMZc/3T5BJspo5 vZ6g== MIME-Version: 1.0 X-Received: by 10.50.187.134 with SMTP id fs6mr10102514igc.79.1358805997470; Mon, 21 Jan 2013 14:06:37 -0800 (PST) Received: by 10.64.53.194 with HTTP; Mon, 21 Jan 2013 14:06:37 -0800 (PST) In-Reply-To: References: Date: Mon, 21 Jan 2013 23:06:37 +0100 Message-ID: Subject: Re: Use ThreadLocalRandom instead of Random From: Philippe Mouawad To: dev@jmeter.apache.org Content-Type: multipart/alternative; boundary=14dae9340747cc427c04d3d3acbb X-Virus-Checked: Checked by ClamAV on apache.org --14dae9340747cc427c04d3d3acbb Content-Type: text/plain; charset=ISO-8859-1 On Mon, Jan 21, 2013 at 11:04 PM, sebb wrote: > On 21 January 2013 21:18, Philippe Mouawad > wrote: > > On Mon, Jan 21, 2013 at 10:03 PM, sebb wrote: > > > >> On 21 January 2013 20:56, Philippe Mouawad > >> wrote: > >> > On Mon, Jan 21, 2013 at 9:45 PM, sebb 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 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. > > I don't doubt that the new Random implementation is faster. > > However, whether that has a significant (measurable) impact on a test > run is another matter. > > >> > >> > > >> >> 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 ? > > Requiring Java 7. > Or extra work on licensing. > > Who can help at Apache with licensing questions ? > > > >> > 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. > -- Cordialement. Philippe Mouawad. --14dae9340747cc427c04d3d3acbb--