Optimal Service Elasticity in Large-Scale Distributed Systems