Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0BA2FDF6C for ; Wed, 2 Jan 2013 10:46:40 +0000 (UTC) Received: (qmail 19105 invoked by uid 500); 2 Jan 2013 10:46:39 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 18928 invoked by uid 500); 2 Jan 2013 10:46:38 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 18917 invoked by uid 99); 2 Jan 2013 10:46:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Jan 2013 10:46:38 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [93.93.130.6] (HELO balrog.mythic-beasts.com) (93.93.130.6) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Jan 2013 10:46:29 +0000 Received: from [92.20.230.137] (helo=[192.168.0.3]) by balrog.mythic-beasts.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1TqLpo-0007ES-Sz for dev@lucene.apache.org; Wed, 02 Jan 2013 10:46:09 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1283) Subject: Re: CC0 license compatibility From: Alan Woodward In-Reply-To: Date: Wed, 2 Jan 2013 10:46:08 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <0631F200-D12C-4A6E-ACA8-30B51F66B652@romseysoftware.co.uk> To: dev@lucene.apache.org X-Mailer: Apple Mail (2.1283) X-BlackCat-Spam-Score: -13 X-Mythic-Debug: Threshold = On = X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-1.4 That's what the sampling code does - it holds an AtomicLongArray of = fixed length, and updates the values in there randomly. There's also an = ExponentiallyDecayingSample which biases the collection of values = towards more recent entries, for the 5-minute and 15-minute window = averages. You can see the patch here: = https://issues.apache.org/jira/secure/attachment/12562854/SOLR-1972_forked= -metrics.patch TBH, I'm not even sure we need a ThreadLocal random here, though. Are = there likely to be thread-safety issues when generating random numbers? On 2 Jan 2013, at 09:24, Dawid Weiss wrote: >> It's used in the statistics package for sampling. The Histogram = class holds a pool of values for calculating means and variances from a = stream of data, and uses the ThreadLocalRandom to determine whether or = not a new value will be added to the pool. >=20 > You probably have talked about it but just to mention -- wouldn't an > algorithmic solution the type of rrd be better than collecting all the > individual samples? Depending on the stats you need of course. From > what I can remember rrd only stores a fixed size buffers so it's very > memory efficient. >=20 > http://code.google.com/p/rrd4j/ >=20 >> This is copied directly from the existing metrics code, and it's = quite possible that there's already something in Lucene that I could use = instead. Which would also clear up the license header problem. :-) >=20 > There isn't in the main codebase I think. A congruential Random should > be pretty trivial to write though (since it's described in the JavaDoc > of Random itself). Doug's ThreadLocal version is useful but if your > code allows it you could just pass individual per-thread Random > instances to any interested code and not deal with ThreadLocals at > all. >=20 > There is also a number of Random implementations in commons-math and > they're definitely Apache licensed :) > http://commons.apache.org/math/userguide/random.html >=20 > D. >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org > For additional commands, e-mail: dev-help@lucene.apache.org >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org