void Stress(ISortedDictionary <int, Person> PeopleStore, ISortedDictionary <int, Address> AddressStore, int MaxCount) { PeopleStore.HintBatchCount = 100; AddressStore.HintBatchCount = 100; PeopleStore.MoveLast(); int mx = MaxCount; Random rdm = new Random(mx); //** NOTE: no batching implemented here, just basic operations... //** see Populate function how to do batch Add in set of 1000 which optimizes SOP/Disk buffer usage //** batch remove can also be done to optimize usage of such buffers & minimize file pointer jumps. for (int i = 0; i < MaxCount / 10; i++) { int no = rdm.Next(mx); Person p; if (i % 2 == 0) { Address addr = new Address(); addr.AddressID = (int)AddressStore.GetNextSequence(); addr.City = "Fremont"; addr.Country = "USA"; addr.State = "California"; addr.Street = string.Format("143{0} LoveLane", i); addr.ZipCode = "99999"; AddressStore.Add(addr.AddressID, addr); p = new Person(); p.AddressID = addr.AddressID; int i2 = no; p.FirstName = string.Format("Joe{0}", i2); p.LastName = "Peter"; p.PhoneNumber = "510-555-9999"; PeopleStore.Add(i2, p); } else { if (PeopleStore.TryGetValue(no, out p)) { AddressStore.Remove(p.AddressID); PeopleStore.Remove(no); } } if (i % 500 <= 1) { if (i % 2 == 0) { PeopleStore.Transaction.Commit(); } else { PeopleStore.Flush(); AddressStore.Flush(); PeopleStore.Transaction.Rollback(); } server.BeginTransaction(); } } Console.WriteLine("Stress ended."); }