internal virtual void SanityCheck([email protected]_Estimates inputEstimates, RecordFormats recordFormats, [email protected]_Visitable baseMemory, params [email protected]_Visitable[] memoryVisitables) { // At this point in time the store hasn't started so it won't show up in free memory reported from OS, // i.e. we have to include it here in the calculations. long estimatedCacheSize = estimatedCacheSize(baseMemory, memoryVisitables); long freeMemory = _freeMemoryLookup.AsLong; long optimalMinimalHeapSize = optimalMinimalHeapSize(inputEstimates, recordFormats); long actualHeapSize = _actualHeapSizeLookup.AsLong; bool freeMemoryIsKnown = freeMemory != VALUE_UNAVAILABLE; // Check if there's enough memory for the import if (freeMemoryIsKnown && actualHeapSize + freeMemory < estimatedCacheSize + optimalMinimalHeapSize) { _monitor.insufficientAvailableMemory(estimatedCacheSize, optimalMinimalHeapSize, freeMemory); return; // there's likely not available memory, no need to warn about anything else } // Check if the heap is big enough to handle the import if (actualHeapSize < optimalMinimalHeapSize) { _monitor.insufficientHeapSize(optimalMinimalHeapSize, actualHeapSize); return; // user have been warned about heap size issue } // Check if heap size could be tweaked if ((!freeMemoryIsKnown || freeMemory < estimatedCacheSize) && actualHeapSize > optimalMinimalHeapSize * 1.2) { _monitor.abundantHeapSize(optimalMinimalHeapSize, actualHeapSize); } }
public static long EstimatedStoreSize([email protected]_Estimates estimates, RecordFormats recordFormats) { long nodeSize = estimates.NumberOfNodes() * recordFormats.Node().getRecordSize(NO_STORE_HEADER); long relationshipSize = estimates.NumberOfRelationships() * recordFormats.Relationship().getRecordSize(NO_STORE_HEADER); long propertySize = estimates.SizeOfNodeProperties() + estimates.SizeOfRelationshipProperties(); long tempIdPropertySize = estimates.NumberOfNodes() * recordFormats.Property().getRecordSize(NO_STORE_HEADER); return(DefensivelyPadMemoryEstimate(nodeSize + relationshipSize + propertySize + tempIdPropertySize)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotDecideToAllocateDoubleRelationshipRecordUnitsonLargeAmountOfRelationshipsOnUnsupportedFormat() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotDecideToAllocateDoubleRelationshipRecordUnitsonLargeAmountOfRelationshipsOnUnsupportedFormat() { // given RecordFormats formats = LATEST_RECORD_FORMATS; using (BatchingNeoStores stores = BatchingNeoStores.BatchingNeoStoresWithExternalPageCache(Storage.fileSystem(), Storage.pageCache(), PageCacheTracer.NULL, Storage.directory().absolutePath(), formats, DEFAULT, NullLogService.Instance, EMPTY, Config.defaults())) { stores.CreateNew(); Input_Estimates estimates = Inputs.knownEstimates(0, DOUBLE_RELATIONSHIP_RECORD_UNIT_THRESHOLD << 1, 0, 0, 0, 0, 0); // when bool doubleUnits = stores.DetermineDoubleRelationshipRecordUnits(estimates); // then assertFalse(doubleUnits); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReportInsufficientHeapSize() public virtual void ShouldReportInsufficientHeapSize() { // given when(_freeMemorySupplier.AsLong).thenReturn(gibiBytes(20)); when(_actualHeapSizeSupplier.AsLong).thenReturn(gibiBytes(1)); when(_baseMemorySupplier.AsLong).thenReturn(gibiBytes(1)); when(_memoryUser1Supplier.AsLong).thenReturn(gibiBytes(1)); when(_memoryUser2Supplier.AsLong).thenReturn(gibiBytes(1)); [email protected]_Estimates estimates = knownEstimates(1_000_000_000, 10_000_000_000L, 2_000_000_000L, 0, gibiBytes(50), gibiBytes(100), 0); // when _checker.sanityCheck(estimates, LATEST_RECORD_FORMATS, _baseMemory, _memoryUser1, _memoryUser2); // then verify(_monitor).insufficientHeapSize(anyLong(), anyLong()); verifyNoMoreInteractions(_monitor); }
public virtual bool DetermineDoubleRelationshipRecordUnits(Input_Estimates inputEstimates) { _doubleRelationshipRecordUnits = _recordFormats.hasCapability(Capability.SECONDARY_RECORD_UNITS) && inputEstimates.NumberOfRelationships() > DoubleRelationshipRecordUnitThreshold; return(_doubleRelationshipRecordUnits); }
/// <summary> /// Calculates optimal and minimal heap size for an import. A minimal heap for an import has enough room for some amount /// of working memory and the part of the page cache meta data living in the heap. /// /// At the time of writing this the heap size is really only a function of store size, where parts of the page cache /// meta data lives in the heap. For reference page cache meta data of a store of ~18TiB takes up ~10GiB of heap, /// so pageCacheHeapUsage ~= storeSize / 2000. On top of that there must be some good old working memory of ~1-2 GiB /// for handling objects created and operating during the import. /// </summary> /// <param name="estimates"> input estimates. </param> /// <param name="recordFormats"> <seealso cref="RecordFormats"/>, containing record sizes. </param> /// <returns> an optimal minimal heap size to use for this import. </returns> public static long OptimalMinimalHeapSize([email protected]_Estimates estimates, RecordFormats recordFormats) { long estimatedStoreSize = estimatedStoreSize(estimates, recordFormats); return(gibiBytes(1) + estimatedStoreSize / 2_000); }