orleans icon indicating copy to clipboard operation
orleans copied to clipboard

why my orleans being slow with 3 node?

Open zhanlanghun opened this issue 8 years ago • 7 comments

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();

zhanlanghun avatar Apr 11 '18 10:04 zhanlanghun

can you share more information, such as logs when client is slow, and what the client is doing etc

xiazen avatar Apr 11 '18 21:04 xiazen

and which version of Orleans are you using

xiazen avatar Apr 11 '18 21:04 xiazen

client:

var client = new ClientBuilder() .Configure(options => { options.ClusterId = "mycluster"; options.ServiceId = "product";

         })
         .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;
            }
        }

zhanlanghun avatar Apr 12 '18 01:04 zhanlanghun

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 avatar Apr 18 '18 22:04 sergeybykov

@sergeybykov ok!!thank you。

zhanlanghun avatar Apr 19 '18 01:04 zhanlanghun

@zhanlanghun Do you have any update?

sergeybykov avatar Apr 27 '18 21:04 sergeybykov

@sergeybykov The problem has been solved. and thank you

zhanlanghun avatar Apr 28 '18 01:04 zhanlanghun