[infinispan-dev] Distributed Counter Discussion

Bela Ban bban at redhat.com
Thu Mar 31 04:22:30 EDT 2016


Note that [1] will make the JGroupsCounter completely async. Currently, 
the wrapper is not async.


[1] https://issues.jboss.org/browse/JGRP-2025

On 29/03/16 19:25, Pedro Ruivo wrote:
> == Status update ==
>
> Hi all,
>
> The work in progress can be found in [1].
>
> The main interface is:
>
> CompletableFuture<Long> addAndGet(long)
>
> The CompletableFuture will allow to cover a more use cases, for example,
> if you need to count the number of visits, you can increment without
> waiting it to complete. On other hand, if you need "unique ids", it is
> possible to increment and wait for the result.
>
> * Let me know any concerns with it.
>
> Currently, two types of counters can be returned by the counter manager:
> "unlimited" and limited (i.e. with thresholds).
>
> "Unlimited" is actually limited to Long.MAX_VALUE but will never throw
> any exception when reached.
> The limited version throws a CounterException when the min or max
> threshold is reached.
> In both cases, it doesn't overflow the counter value.
>
> Currently, I'm working in the notification mechanism. So, just ignore
> that part of the code :)
>
> Moving to the next problem, I need an opinion how to create the counter
> manager.
>
> The current implementation is using a private cache. It has the
> advantage of starting the cache when a cache manager starts, however, it
> is a bit difficult to configure (e.g. persistence). Also, it does not
> allow different configuration for the counter (replicated vs
> distributed, persisted or not).
>
> Another alternative, it to construct the counter manager with the cache
> manager and a cache name. This looks simpler and it allows the user to
> configure it properly and have different counter manager with different
> configurations.
>
> * Comments are welcome.
>
> Cheers,
> Pedro
>
> [1] https://github.com/pruivo/infinispan/tree/t_counters/distributed-counter
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>

-- 
Bela Ban, JGroups lead (http://www.jgroups.org)



More information about the infinispan-dev mailing list