【问题标题】:apache ignite destroycache socket-timeout or very slowapache ignite destroycache socket-timeout 或者很慢
【发布时间】:2022-01-27 13:22:30
【问题描述】:

在此处下载示例:https://github.com/apache/ignite/tree/master/modules/platforms/dotnet/examples

调整ServerNode.Program.cs中的代码

   namespace Apache.Ignite.Examples.ServerNode
{
    public static class Program
    {
        public static void Main()
        {
            using (var ignite = Ignition.Start(Utils.GetServerNodeConfiguration()))
            {
                ignite.GetCluster().SetActive(true);  **//add one line code here**
                Utils.DeployDefaultServices(ignite);
                .....
            }
        }
    }
}

调整Util.cs中的代码

public static IgniteConfiguration GetServerNodeConfiguration()
        {
            return new IgniteConfiguration
            {
                Localhost = "127.0.0.1",
                .......
                PeerAssemblyLoadingMode = PeerAssemblyLoadingMode.CurrentAppDomain,
                **//add some code here to enable persistence**
                DataStorageConfiguration = new DataStorageConfiguration
                {
                    DefaultDataRegionConfiguration = new DataRegionConfiguration
                    {
                        Name = "Default_Region",
                        PersistenceEnabled = true 
                    }
                }
            };
        }

将destroycache方法添加到Apache.Ignite.Examples.Thin.Sql.LinqThin.Program Main方法中如下:

public static void Main()
        {
            using (var ignite = Ignition.StartClient(Utils.GetThinClientConfiguration()))
            {
                Console.WriteLine();
                Console.WriteLine(">>> Cache LINQ example started.");
                ........

                var sw = Stopwatch.StartNew();
                ignite.DestroyCache(OrganizationCacheName);
                sw.Stop();
                Console.WriteLine($"DESTROY COST {sw.ElapsedMilliseconds}");
                .....
            }

             ....
        }

在执行detroyCache方法时,有时会抛出socket timeout异常,或者detroy成功有时会花费很长时间。 但是如果不启用持久性,当destroyCache 时一切正常。

【问题讨论】:

    标签: caching ignite


    【解决方案1】:

    使用持久性创建和销毁缓存可能会变慢,尤其是在 HDD(与 SSD 相对)上。

    您可以像这样增加套接字超时:

                var cfg = new IgniteClientConfiguration
                {
                    ...
                    SocketTimeout = TimeSpan.FromSeconds(15)
                };
    

    话虽如此,我已经尝试了上述步骤,它在我的机器(Core i7-9700,SSD)上打印了DESTROY COST 140。

    【讨论】:

    • 谢谢@Pavel。但我想知道为什么destroyCache 这么慢。我尝试了 600 个 Orgnization 对象,销毁时间为 30 秒。为什么销毁持久性数据这么慢!!
    • @user17785356 你的硬件是什么? CPU、磁盘?
    • 谢谢@Pavel。我的硬件: CPU: Intel(R) Core(TM) i5-10400 @2.90GHz 12 Cores;内存:16GB;操作系统:Windows-10 企业版 LTSC;点网5.0; JDK 11;点燃11;
    • 除了我在问题中提到的 3 点之外,我什么也没修改。
    • 你好,我的持久化数据在HDD盘上,容量足够(共464G)
    猜你喜欢
    • 2017-07-14
    • 2020-08-16
    • 2018-11-08
    • 1970-01-01
    • 1970-01-01
    • 2018-08-07
    • 2012-02-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多