On the fly code updates orleans

405 Views Asked by At

First of all I'm new to Orleans, but I've read some of the documentation already and I have to say the project looks very promising. I have a question in terms of how to update code of the grains on Silos in a production environment.

I know Erlang has an actor model and in Whatsapp they can perform onthefly updates of the code. Is that somethings possible currently on Orleans or do I have to stop silos and deploy the new code? If so can this be done programatically?

Thanks!

1

There are 1 best solutions below

5
On

I don't think you can deploy code on the fly as you say. Grains are classes, and they may depend on other classes, and all these classes are found in DLLs. If you add a new class for instance, you have to deploy that DLL onto all your silos.

Note: I'm using "server" and "silo" interchangeably here.

What you can do to avoid downtime is deploy part of your servers, switch your traffic to them, and then deploy the remaining servers. Orleans deployments support a DeploymentId which is unique for the cluster. If you deploy your silos with a new DeploymentId, they will not join the old cluster.

The description in the previous paragraph might sound a little abstract, so let's take a practical example. You have 5 servers, all on the same cluster with DeploymentId 123, and a load balancer forwards traffic to each of them in round robin style.

  1. You turn off the first 3 silos. The cluster notices the departure of the nodes and adjusts. The load balancer also notices and forwards traffic only to the last 2 nodes (which still have DeploymentId 123).
  2. You deploy the updated code on the first 3 silos with DeploymentId 456, and turn them on. The DeploymentId is different so they won't join the old cluster.
  3. You point the load balancer to the first 3 silos. You are effectively running on the new code now, as the last 2 silos won't get any requests.
  4. You turn off the last 2 silos and deploy them with the new DeploymentId (456). When you turn them on, they join the new cluster.
  5. You adjust the load balancer to point to all 5 nodes.