Optimizing for long-term cost management in fully managed applications