Pergunta de entrevista da empresa Arimo

There are 1 billion web objects that are hashed with MD5 and distributed to 100 servers using continuous and evenly distributed hash values so that each of the 100 servers get the same number of the share of 1B web objects (1B/100). If we add server number 101 and re-distribute the objects evenly and contiguously, what are the total number of objects that would be assigned to a different server than before. Not sure why they asked this question to a pre-sales interview.

Resposta da entrevista

Sigiloso

22 de nov. de 2015

10M objects per server originally. When server # 101 is added, then we get ~9.9M objects that each server can hold. From the first server, 0.1M objects will move over to 2nd server (since the objects are contiguously assigned). In 2nd server, the 0.1M from the end will move to 3rd server. However since the 2nd server also needs to accept the 0.1M from first server and it has reduced capacity of 9.9M, a total of 0.2M objects will move to the 3rd server. Therefore the total number of objects that will move (in millions) = sum of series, 0.1 + 0.2 + 0.3 + ... + 10.