Optimal and automated deployment for microservices