Optimizing Memory-Efficient Algorithms For Low-Cost And Scalable Network Services