I know that by default, Bluemix / Cloud Foundry use round-robin load balancing. Is there a way to change that? If I deploy 2 apps with the same route, and want 90% of my traffic to go to blue, and 10% to green, is that possible?
问题:
回答1:
You would have to deploy more than two instances of the app to have better than 50-50 control over who sees what. If you have 10 instances, for example, and you update 1, then you could get your 90-10 split.
Check out this CF CLI plugin: https://github.com/krujos/scaleover-plugin
回答2:
Configuring the load balancer is not possible.
回答3:
One workaround you could use to "simulate" a load balancer would be to set up an application which fronts all of the requests. Bind the route to this application and then include some logic inside it which just redirects traffic to the other services in a 9:1 ratio.
The risks of using this approach are:
- Your load-balancer application could theoretically go down
- Your load-balancer application doesn't know the status of the other two services so might route traffic to an offline service instance
You can minimize the first risk by using multiple instances on the "load balancer" app.
回答4:
You want to implement Blue-Green Deployment.
If you have deployed your Cloudfoundry PaaS on AWS, you might take help of AWS Route53 to manage it.
You can specify your routes of the apps in route53 and send weighted traffic.
Then You can specify how much traffic you want to send to one route and how much to the other.
Hope it Helps.. :)