I hope you will be keeping each IP address as an znode in ZooKeeper. Also, if you don't have any costly operation before storing the znode in ZooKeeper, there is an optimistic way. When a request comes, pick one of the available IP from the pool and try create IP znode in ZooKeeper. Say, if two are trying to create same znode in ZK simultaneously, one will get "KeeperException.NodeExistsException". Now pick another available one optimistically and creates again.
Regards, Rakesh On Sat, Jun 7, 2014 at 11:33 PM, Kapil <[email protected]> wrote: > Thanks Rakesh for mail, > My functionality is as follows. > I am going to use zookeeper to allocate IP addresses. So it will allocate > Ip > address from given pool of available IP addresses each time request comes. > Once Ip address allocated I am going to store it in znode to maintain > record > so that I can know dynamically each time which IP addresses are available. > So each time while allocating IP address I have some concurrency mechanism > to do this. > So I was only confused that if updates are A-Sequential why do we need > locks. But I think I now understand that since my update operation is > divided into number of individual atomic updates I will have to implement > locking. > > Thanks > > > > > -- > View this message in context: > http://zookeeper-user.578899.n2.nabble.com/Distributed-Applocation-using-Zookeeper-tp7579952p7579966.html > Sent from the zookeeper-user mailing list archive at Nabble.com. >
