Implementing custom affinity logic

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

Implementing custom affinity logic

kotamrajuyashasvi
Hi

I m working on an ignite project where I want to have certain records to be
collocated based
on a custom calculated value which is obtained from the fields of the
primary key object.

For example the Primary key pojos have fields a,b,c. I want all records
having same value of (a+b)/c
collocated on same node/partition.
 
I have gone through the ignite documentation and found that custom
AffinityKeyMapper is the
one that can be used. Also there is an option to use custom Affinity
function but extra logic has to be added for partition to node mapping etc..

1. How can I achieve my above requirement? What are the correct options and
where can
    I get a working example of custom AffinityKeyMapper or AffinityFunction
?

2. Once after achieving custom affinity how to test if all records are
getting collocated as expected. One
    option that I found was to use scan query and scan a particular
partition and test each record if it
    should actually belong to the scanned partition. But if there are huge
number of records I'm facing
    OOM while running scan query for a partition. So I would like to know
how to achieve this/ test to
    confirm for sure the collocation is as expected.

3. What is the performance impact of using custom affinity logic when
compared to using no affinity and
    using @AffinityKeyMapped annotation to achieve affinity where the
scenario is to collocate based on
    a single field.

4. When using @AffinityKeyMapped or no affinity is used, is
   
org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper
is used as default
    AffinityKeyMapper ? or there is any other default module that is used
for calculating affinity ?




--
Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Implementing custom affinity logic

Dmitriy Pavlov
Hi,

 In case these questions are not related to some PR/Issue or contribution,
than user list probably is better place to ask these questions.

Sincerely,
Dmitriy Pavlov

пн, 23 июл. 2018 г. в 13:24, kotamrajuyashasvi <[hidden email]
>:

> Hi
>
> I m working on an ignite project where I want to have certain records to be
> collocated based
> on a custom calculated value which is obtained from the fields of the
> primary key object.
>
> For example the Primary key pojos have fields a,b,c. I want all records
> having same value of (a+b)/c
> collocated on same node/partition.
>
> I have gone through the ignite documentation and found that custom
> AffinityKeyMapper is the
> one that can be used. Also there is an option to use custom Affinity
> function but extra logic has to be added for partition to node mapping
> etc..
>
> 1. How can I achieve my above requirement? What are the correct options and
> where can
>     I get a working example of custom AffinityKeyMapper or AffinityFunction
> ?
>
> 2. Once after achieving custom affinity how to test if all records are
> getting collocated as expected. One
>     option that I found was to use scan query and scan a particular
> partition and test each record if it
>     should actually belong to the scanned partition. But if there are huge
> number of records I'm facing
>     OOM while running scan query for a partition. So I would like to know
> how to achieve this/ test to
>     confirm for sure the collocation is as expected.
>
> 3. What is the performance impact of using custom affinity logic when
> compared to using no affinity and
>     using @AffinityKeyMapped annotation to achieve affinity where the
> scenario is to collocate based on
>     a single field.
>
> 4. When using @AffinityKeyMapped or no affinity is used, is
>
>
> org.apache.ignite.internal.processors.cache.GridCacheDefaultAffinityKeyMapper
> is used as default
>     AffinityKeyMapper ? or there is any other default module that is used
> for calculating affinity ?
>
>
>
>
> --
> Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/
>