Shared counter

classic Classic list List threaded Threaded
2 messages Options
Bastien Durel Bastien Durel
Reply | Threaded
Open this post in threaded view
|

Shared counter

Hello,

I whish to know if there is a supported way to implement some kind of
shared counter in ignite, where any node could increment or decrement a
value, which would be decremented automatically if a node is leaving
the cluster ?
I know I can use an AtomicInteger but there will be no decrement on
exit, i guess ?

Should I use a cache with <node_id, counter> (summing all counters) and
manually evict rows when I get a EVT_NODE_FAILED/EVT_NODE_LEFT event,
or is there a better way ?

Thanks,

--
Bastien Durel
DATA
Intégration des données de l'entreprise,
Systèmes d'information décisionnels.

[hidden email]
tel : +33 (0) 1 57 19 59 28
fax : +33 (0) 1 57 19 59 73
12 avenue Raspail, 94250 GENTILLY France
www.data.fr

p.srikanta p.srikanta
Reply | Threaded
Open this post in threaded view
|

Re: Shared counter

Hi Bastien,

Ignore provides the ability to have distributed data structure. And in your case an atomic long would work as a distributed counter.



Regards,
Srikanta

On Wed, 26 Aug 2020, 12:24 pm Bastien Durel, <[hidden email]> wrote:
Hello,

I whish to know if there is a supported way to implement some kind of
shared counter in ignite, where any node could increment or decrement a
value, which would be decremented automatically if a node is leaving
the cluster ?
I know I can use an AtomicInteger but there will be no decrement on
exit, i guess ?

Should I use a cache with <node_id, counter> (summing all counters) and
manually evict rows when I get a EVT_NODE_FAILED/EVT_NODE_LEFT event,
or is there a better way ?

Thanks,

--
Bastien Durel
DATA
Intégration des données de l'entreprise,
Systèmes d'information décisionnels.

[hidden email]
tel : +33 (0) 1 57 19 59 28
fax : +33 (0) 1 57 19 59 73
12 avenue Raspail, 94250 GENTILLY France
www.data.fr