sashapolo commented on code in PR #7513:
URL: https://github.com/apache/ignite-3/pull/7513#discussion_r2774094142


##########
modules/page-memory/src/jmh/java/org/apache/ignite/internal/pagememory/benchmark/PageReplacementBenchmark.java:
##########
@@ -114,9 +114,33 @@ public enum CachePressure {
 
         int computeWorkingSetSize(long capacity) {
             long result = Math.round(capacity * multiplier);
-            assert result <= Integer.MAX_VALUE : "Working set too large: " + 
result;
+            validateWorkingSetSize(result);
             return (int) result;
         }
+
+        private static void validateWorkingSetSize(long workingSetSize) {
+            assert workingSetSize <= Integer.MAX_VALUE : "Working set too 
large: " + workingSetSize;
+
+            if (workingSetSize > MAX_WORKING_SET_SIZE) {
+                throw new IllegalStateException(String.format(
+                        "Working set too large: %,d pages (max: %,d). "
+                                + "This would require %,d GB of actual page 
memory and %,d MB for pageId array. "
+                                + "Reduce cache pressure or region size.",
+                        workingSetSize,
+                        MAX_WORKING_SET_SIZE,
+                        (workingSetSize * PAGE_SIZE) / Constants.GiB,
+                        (workingSetSize * 8L) / Constants.MiB
+                ));
+            }
+
+            long minWorkingSetSize = Math.round(REGION_CAPACITY_PAGES * 
MIN_WORKING_SET_RATIO);

Review Comment:
   It's strange that we have `MAX_WORKING_SET_SIZE` but not 
`MIN_WORKING_SET_SIZE` constant =)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to