Algorithms for scalable content distribution