In my previous post, I showed how to add MS Orleans to an existing WebAPI application. I also mentioned my frustrations around the documentation for MS Orleans. In the documentation, it says that Cluster ID
'is a unique ID for the Orleans cluster. All clients and silos that use this ID will be able to talk directly to each other. You can choose to use a different ClusterId for different deployments, though.'
Most of the sample codes just have this set to a constant value, so I originally had the cluster ID set to ‘dev-SampleMsOrleans’. This worked fine. However, the next day when I run the application again, it crashed with the below exception.
Failed to get ping responses from 1 of 1 active silos. Newly joining silos validate connectivity with all active silos that have recently updated their 'I Am Alive' value before joining the cluster.
After a bit of research, it turned out this had to do with previous silo instances did not shutdown properly. There are 2 potential options for this issue
- Properly shutdown the silo instance.
- Use different cluster ID for each deployment
I went with option 2 since I could not find from the documentation how to properly shut it down when hosting silos as part of the WebAPI. The cluster ID now looks like this.
.Configure<ClusterOptions>(options =>
{
options.ClusterId = $"dev-{Guid.NewGuid()}";
options.ServiceId = "SampleMsOrleans";
})
Note that this is not an issue if you host your silos in memory.