why my orleans being slow with 3 node?
when 1 node was running, the client is fast, when 3 node was running ,the client is fast At first, but being slow after A few minutes。
const string connectionString = "Server=192.168.2.113;Database=TestOrleans;User Id=sa;Password=sa;";
// var configuration = new ConfigurationBuilder()
// .AddJsonFile("HostSettings.json", true, true)
// .Build();
//var port= configuration.GetValue<int>("configProperties:Net.Port");
//var gatePort= configuration.GetValue<int>("configProperties:GateWay.Port");
var netport = System.Configuration.ConfigurationManager.AppSettings["netport"];
var gatewayport = System.Configuration.ConfigurationManager.AppSettings["gatewayport"];
var silo = new SiloHostBuilder()
.Configure<ClusterOptions>(options =>
{
options.ClusterId = "mycluster";
options.ServiceId = "product";
})
.Configure <GrainCollectionOptions>(options=> {
//配置grain的回收
options.CollectionAge = TimeSpan.FromMinutes(10);
options.CollectionQuantum = TimeSpan.FromMinutes(5);
})
.UseAdoNetClustering(options =>
{
options.ConnectionString = connectionString;
options.Invariant = "System.Data.SqlClient";
})
.ConfigureEndpoints(System.Net.Dns.GetHostName(),int .Parse( netport),int .Parse( gatewayport))
.ConfigureLogging(logging =>logging.SetMinimumLevel(LogLevel.Warning).AddConsole())
// .ConfigureLogging(builder => builder.SetMinimumLevel(LogLevel.Warning).AddConsole())
.Build();
silo.StartAsync().Wait();
Console.WriteLine("启动成功");
Console.Read();
silo.Dispose();
can you share more information, such as logs when client is slow, and what the client is doing etc
and which version of Orleans are you using
client:
var client = new ClientBuilder()
.Configure
})
.Configure<ClientMessagingOptions>(option =>
{
option.ClientSenderBuckets = 100;
})
.UseAdoNetClustering(options =>
{
options.ConnectionString = connectionString;
options.Invariant = "System.Data.SqlClient";
})
.Build();
await client.Connect();
int i = 1;
IProduct friend = null;
while (i < 10000000)
{
try
{
friend = client.GetGrain<IProduct>(i);
await friend.GetProduct(i);
}
catch (Exception e)
{
}
i++;
//await Task.Delay(1);
if (i >= 200000)
{
i = 1;
}
}
when 3 node was running ,the client is fast At first, but being slow after A few minutes。
I see no measurement of timing in your code. How do you see that it's getting slow after a few minutes?
BTW, running a loop with an await for each call is not exercising the capacity of the cluster, as only one grain call runs at any point in time. You can fan out a larger number of them (100 or 1000) in parallel and await them all.
@sergeybykov ok!!thank you。
@zhanlanghun Do you have any update?
@sergeybykov The problem has been solved. and thank you