PeerSim: A scalable P2P simulator