Algorithms For Measuring And Enhancing Distributed Systems