1. A method for replicating data based on capacity optimization, said method comprising: a local node receiving the data in an extent configured for a system, the extent being associated with a key for indexing, wherein the system comprises at least one domain coupled to a communication network, wherein each domain of said at least one domain comprises at least one node and a respective distributed hash table (DHT) for said each domain, wherein each node of said at least one node comprises a respective storage array storing respective primary data and respective replicas of selected data stored in the respective primary data of said at least one node; determining, by a processor of a computer in which the local node operates, that the received extent does not exist in primary data of the local node; querying said at least one domain in the system for a duplicate of the extent by use of the respective DHT for said each domain such that only a respective owner node is queried for the duplicate of the extent within said each domain, wherein the respective owner node of said each domain owns a key range in which the key associated with the extent falls in; determining a replication strategy based on factors and a result from said querying, wherein said replication strategy is selected from the group consisting of establishing replica relationship among existing duplicates, creating a new remote duplicate, and creating a new local duplicate; and recording the extent into said primary data of the local node by updating a local hash table and extent metadata of the local node.