On 24/02/12 8:05 AM, Benjamin Manes wrote:
Hi,
I'm the author of CLHM, brought to you by a friendly Google alert. :)

Hi Ben

If Cayenne is currently using Guava, then there won't be a dependency increase. 
I helped rearchitect MapMaker and design its replacement, CacheBuilder, which 
are based on CLHM's algorithms. This is a more feature-rich implementation with 
the support of a team at Google (whereas CLHM is my weekend project). We also 
fixed my mistake of only weighing by value, since I hadn't realized how popular 
memory-based weighing would be (I was trying to avoid unbounded collections as 
values).

Very interesting. Will you be bringing the LIRS features across to CacheBuilder 
as well?

Also, would it be hard to limit the size of the cache in bytes rather than 
number of entries?

Technically CLHM provides more concurrency than CacheBuilder by not relying on 
segment locks and later using a lock-free ring buffer. These will be an 
advantage when it is backed by JDK8's new CHM (see ConcurrentHashMapV8) or 
Cliff Click's NBHM. A JSR-166 implementation will be a marriage of CHMv8, CLHM, 
and CacheBuilder.

Isn't JSR166 already finished?


CLHM is back-ported to JDK5 on every release, so you'll find the JDK5 source 
under /tags. I do development on /trunk assuming JDK6.

Feel free to file issues against CLHM (or Guava) if you'd like enhancements to 
either. Both are used in large production environments.

Andrus, I notice that CacheBuilder can be set to concurrency=1 which means that 
write operations are sequential even though read operations are still 
concurrent. Would that help at all with the testing concern you have?


Ari



Cheers,
Ben

--
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Reply via email to