Reputation: 352
I am starting a side-project with Microsoft Orleans (it is a relatively simple online game) and I have a doubt about the deploy and the structure in relation to the Co-Hosted Clients (https://dotnet.github.io/orleans/docs/host/client.html#co-hosted-clients)
The game itself will be a Blazor application that will be connected to a Web Api, and here is where my doubt arises: according to the Orleans documentation, the Silo (or "grain code" as they say) should be in the same process as the client, which in this case will be the Web Api.
I don't know if I missed something, but I understand that this means that I will have a instance of Web Api in each silo, in a 1:1 relationship, right? If one wants to deploy a cluster with 5 silos for example, I will have an instance of the Web Api in each of them...? This sounds a bit strange to me.
As I say, this seems to be the recommendation, but I am going here a problem of how to scale these elements separately, because surely I will want more Silos than Web Apis?
Is this the way it is or am I wrong and I am mixing concepts?
Upvotes: 2
Views: 1022
Reputation: 2593
You do not have to run the frontend (ASP.NET Core with Blazor in this case) and the Orleans silo in the same host.
Create two projects, one that hosts the silo, and one that hosts the web site. The web site uses ClusteredClient to connect to the silo, and uses clusteredClient.GetGrain("abc") to access the grains.
This way you can run the frontend project in a separate AppService in Azure, and then run the Silo project as a Container App.
Upvotes: 2