Exemple #1
0
 public MMFEventQueue()
 {
     pile = new MMFPile("workloadevents");
     pile.DataDirectoryRoot = System.IO.Path.GetTempPath();
     pointers = new ConcurrentQueue <PilePointer>();
     pile.Start();
 }
Exemple #2
0
        public void Configuration()
        {
            var conf = @"
 app
 {
   memory-management
   {
     pile
     {
       alloc-mode=favorspeed
       free-list-size=100000
       max-segment-limit=79
       segment-size=395313143 //will be rounded to 16 byte boundary: 395,313,152
       max-memory-limit=123666333000
       data-directory-root=$'@@@ROOT'
       free-chunk-sizes='128, 256, 512, 1024, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 16000, 32000, 64000,  256000'
     }

     pile
     {
       name='specialNamed'
       identity=1900
       free-list-size=99000
       max-segment-limit=73
       segment-size=395313147 //will be rounded to 16 byte boundary: 395,313,152
       max-memory-limit=127666333000
       data-directory-root=$'@@@ROOT'
       free-chunk-sizes='77, 124, 180, 190, 200, 210, 220, 230, 1000, 2000, 3000, 4000, 5000, 32000, 64000,  257000'
     }
   }
 }".Replace("@@@ROOT", LOCAL_ROOT).AsLaconicConfig(handling: ConvertErrorHandling.Throw);

            using (var app = new ServiceBaseApplication(null, conf))
            {
                using (var pile = new MMFPile())
                {
                    pile.Configure(null);

                    Aver.IsTrue(AllocationMode.FavorSpeed == pile.AllocMode);
                    Aver.AreEqual(100000, pile.FreeListSize);
                    Aver.AreEqual(79, pile.MaxSegmentLimit);
                    Aver.AreEqual(395313152, pile.SegmentSize);
                    Aver.AreEqual(123666333000, pile.MaxMemoryLimit);

                    Aver.AreEqual(128, pile.FreeChunkSizes[00]);
                    Aver.AreEqual(256, pile.FreeChunkSizes[01]);
                    Aver.AreEqual(512, pile.FreeChunkSizes[02]);
                    Aver.AreEqual(1024, pile.FreeChunkSizes[03]);
                    Aver.AreEqual(2000, pile.FreeChunkSizes[04]);
                    Aver.AreEqual(3000, pile.FreeChunkSizes[05]);
                    Aver.AreEqual(4000, pile.FreeChunkSizes[06]);
                    Aver.AreEqual(5000, pile.FreeChunkSizes[07]);
                    Aver.AreEqual(6000, pile.FreeChunkSizes[08]);
                    Aver.AreEqual(7000, pile.FreeChunkSizes[09]);
                    Aver.AreEqual(8000, pile.FreeChunkSizes[10]);
                    Aver.AreEqual(9000, pile.FreeChunkSizes[11]);
                    Aver.AreEqual(16000, pile.FreeChunkSizes[12]);
                    Aver.AreEqual(32000, pile.FreeChunkSizes[13]);
                    Aver.AreEqual(64000, pile.FreeChunkSizes[14]);
                    Aver.AreEqual(256000, pile.FreeChunkSizes[15]);

                    pile.Start();//just to test that it starts ok
                }

                using (var pile = new MMFPile("specialNamed"))
                {
                    pile.Configure(null);

                    Aver.AreEqual(1900, pile.Identity);

                    Aver.IsTrue(AllocationMode.ReuseSpace == pile.AllocMode);
                    Aver.AreEqual(99000, pile.FreeListSize);
                    Aver.AreEqual(73, pile.MaxSegmentLimit);
                    Aver.AreEqual(395313152, pile.SegmentSize);
                    Aver.AreEqual(127666333000, pile.MaxMemoryLimit);

                    Aver.AreEqual(77, pile.FreeChunkSizes[00]);
                    Aver.AreEqual(124, pile.FreeChunkSizes[01]);
                    Aver.AreEqual(180, pile.FreeChunkSizes[02]);
                    Aver.AreEqual(190, pile.FreeChunkSizes[03]);
                    Aver.AreEqual(200, pile.FreeChunkSizes[04]);
                    Aver.AreEqual(210, pile.FreeChunkSizes[05]);
                    Aver.AreEqual(220, pile.FreeChunkSizes[06]);
                    Aver.AreEqual(230, pile.FreeChunkSizes[07]);
                    Aver.AreEqual(1000, pile.FreeChunkSizes[08]);
                    Aver.AreEqual(2000, pile.FreeChunkSizes[09]);
                    Aver.AreEqual(3000, pile.FreeChunkSizes[10]);
                    Aver.AreEqual(4000, pile.FreeChunkSizes[11]);
                    Aver.AreEqual(5000, pile.FreeChunkSizes[12]);
                    Aver.AreEqual(32000, pile.FreeChunkSizes[13]);
                    Aver.AreEqual(64000, pile.FreeChunkSizes[14]);
                    Aver.AreEqual(257000, pile.FreeChunkSizes[15]);

                    pile.Start();//just to test that it starts ok
                }
            }//using app
        }