lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Woodward <alan.woodw...@romseysoftware.co.uk>
Subject Re: CC0 license compatibility
Date Wed, 02 Jan 2013 10:46:08 GMT
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.
> 
> 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.
> 
> http://code.google.com/p/rrd4j/
> 
>> 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.  :-)
> 
> 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.
> 
> 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
> 
> D.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message