Predictive autoscaling and cost optimization in the cloud