0

download the example here:https://github.com/apache/ignite/tree/master/modules/platforms/dotnet/examples

Adjust the code in 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);
                .....
            }
        }
    }
}

Adjust the code in 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 
                    }
                }
            };
        }

Add the destroycache method into Apache.Ignite.Examples.Thin.Sql.LinqThin.Program Main method like this:

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

             ....
        }

When execute the detroyCache method, it throws socket timeout exception sometimes, or it cost long time sometimes if destroy successfully. But all is OK when destroyCache if donot enable persistence.

1 Answers1

0

Creating and destroying caches can be slower with persistence, especially on HDD (as opposed to SSD).

You can increase socket timeout like this:

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

That being said, I've tried the steps above and it prints DESTROY COST 140 on my machine (Core i7-9700, SSD).

Pavel Tupitsyn
  • 8,393
  • 3
  • 22
  • 44
  • THANK YOU@Pavel. But I want to know why destroyCache so slow. I tried 600 Orgnization objects, and it cost 30 seconds to destroy. Why destroy persistence data so slow !! – user17785356 Dec 29 '21 at 10:59
  • @user17785356 what is your hardware? CPU, disk? – Pavel Tupitsyn Dec 29 '21 at 11:32
  • THANK YOU@Pavel. My hardware: CPU: Intel(R) Core(TM) i5-10400 @2.90GHz 12 Cores; RAM:16GB; OS: Windows-10 Enterprise LTSC; Dotnet 5.0; JDK 11; Ignite 11; – user17785356 Dec 29 '21 at 13:31
  • I modified nothing except the 3 points as i mentioned above in my question. – user17785356 Dec 29 '21 at 13:37
  • hello, My persistence data is on HDD disk and its capacity is enough(Total 464G) – user17785356 Dec 30 '21 at 01:14
  • @user17785356 Ignite persistence is optimized for industry-grade SSD storage. Using HDDs, especially consumer-grade, is not recommended. https://ignite.apache.org/docs/latest/persistence/persistence-tuning#purchase-production-level-ssds – Pavel Tupitsyn Dec 30 '21 at 06:17