Algorithm to rebalance virtual nodes in consistent hashing solution in PostgreSQL?

1k views Asked by At

I'm using PostgreSQL 9.3 and I have implemented Consistent hashing with virtual nodes using plproxy.

In current setting node addition and rebalancing among nodes is working ( data movement between servers is done using PostgrelSQL foreign data wrappers ).

But there's one limitation. In current setting all physical nodes are assumed to be equal. i.e there is no way to give virtual node count per server when node is added. I want to build this behaviour too.

So I'm asking what would be the better algorithm to implement this. Current algorithm just distribute the virtual node capacity of servers evenly among servers. In new algorithm i would like to see minimum amount for virtual node movement.

Ex:

Assume we have cluster of 4 servers and each server having 64 virtual nodes ( total of 256 virtual nodes). I want to add server ( server X ) which is having 200 ( or some percentage of virtual nodes) virtual nodes so that each 4 servers contribute equally to the this new server to satisfy it's virtual node count to some extent.

BUT when new node is added (i.e server X ) I don't want to allocate all 200 for that server. I need a algorithm to assign some percentage from existing servers so that, new server's 200 nodes need is satisfied to some extent as well as previous 4 servers don't loose there virtual node count hugely.

What would be the better strategy to divide the virtual node among physical servers ?

0

There are 0 answers