public void NotifyAboutGet() { Interlocked.Increment(ref _getCount); if (_getCount == _desiredGetCount) { Task.Run(() => { var sw = new Stopwatch(); sw.Start(); Console.WriteLine($"{DateTime.Now.ToLongTimeString()} Started preparation for POST"); //_swMemory = new System.Timers.Timer(1000); //_swMemory.Elapsed += (sender, args) => { TotalMemoryHelper.Show(); }; //_swMemory.Start(); StatusData.PrepareForUpdates(); CityData.PrepareForUpdates(); CountryData.PrepareForUpdates(); SNameData.PrepareForUpdates(); FNameData.PrepareForUpdates(); SexData.PrepareForUpdates(); PremiumData.PrepareForUpdates(); CodeData.PrepareForUpdates(); DomainData.PrepareForUpdates(); BirthYearData.PrepareForUpdates(); InterestsData.PrepareForUpdates(); JoinedYearData.PrepareForUpdates(); TotalMemoryHelper.Show(); GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; GC.Collect(); GC.WaitForFullGCApproach(); TotalMemoryHelper.Show(); Console.WriteLine($"{DateTime.Now.ToLongTimeString()} Finished preparation for POST in {sw.ElapsedMilliseconds} ms"); }); } }
private void Statistics(bool full) { Console.WriteLine($"Current TimeStamp: {Holder.Instance.CurrentTimeStamp}"); Console.WriteLine($"Sex {SexData.GetStatistics(full)}"); Console.WriteLine($"Status {StatusData.GetStatistics(full)}"); Console.WriteLine($"Premium {PremiumData.GetStatistics(full)}"); Console.WriteLine($"City {CityData.GetStatistics(full)}"); Console.WriteLine($"Country {CountryData.GetStatistics(full)}"); Console.WriteLine(value: $"Code {CodeData.GetStatistics(full)}"); Console.WriteLine($"Domain {DomainData.GetStatistics(full)}"); Console.WriteLine($"FName {FNameData.GetStatistics(full)}"); Console.WriteLine($"SName {SNameData.GetStatistics(full)}"); Console.WriteLine($"Interests {InterestsData.GetStatistics(full)}"); Console.WriteLine($"BirthYear {BirthYearData.GetStatistics(full)}"); Console.WriteLine($"JoinedYear {JoinedYearData.GetStatistics(full)}"); }
public void CreateMainIndexes(bool afterPost, Stopwatch sw) { if (afterPost) { FNameData.PrepareForSort(); SNameData.PrepareForSort(); SexData.PrepareForSort(); StatusData.PrepareForSort(); CityData.PrepareForSort(); CountryData.PrepareForSort(); CodeData.PrepareForSort(); DomainData.PrepareForSort(); BirthYearData.PrepareForSort(); InterestsData.PrepareForSort(); JoinedYearData.PrepareForSort(); PremiumData.PrepareForSort(); GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce; GC.Collect(); GC.WaitForFullGCApproach(); Console.WriteLine($"Preparation for sort done in [{sw.ElapsedMilliseconds}] ms"); Task.Run(() => { LikesBuffer.FillLikes(); LikesBuffer = null; Console.WriteLine($"Likes filling done in [{sw.ElapsedMilliseconds}] ms"); }); } var preparationForGroup1 = Task.Run(() => { EmailsStorage.SortAndPropagate(); FNameData.Sort(); SNameData.Sort(); SexData.Sort(); }); var preparationForGroup2 = Task.Run(() => { StatusData.Sort(); CityData.Sort(); CountryData.Sort(); CodeData.Sort(); DomainData.Sort(); }); var preparationForGroup3 = Task.Run(() => { BirthYearData.Sort(); InterestsData.Sort(); JoinedYearData.Sort(); PremiumData.Sort(); }); Task.WaitAll(preparationForGroup1, preparationForGroup2, preparationForGroup3); Console.WriteLine($"Ids sorting done in [{sw.ElapsedMilliseconds}] ms"); Holder.Instance.Group.CleanCacheAndCreateNewCache(); Console.WriteLine($"Cache recreating done in [{sw.ElapsedMilliseconds}] ms"); Statistics(false); }