ringles commented on a change in pull request #6296:
URL: https://github.com/apache/geode/pull/6296#discussion_r617664346



##########
File path: 
geode-apis-compatible-with-redis/src/test/java/org/apache/geode/redis/internal/data/RedisHashTest.java
##########
@@ -258,6 +258,13 @@ public void hscanSnaphots_shouldExpireAfterExpiryPeriod() {
     });
   }
 
+  @Test
+  public void 
hashSizeOverhead_shouldNotBeChanged_withoutForethoughtAndTesting() {
+    assertThat(RedisHash.PER_OBJECT_OVERHEAD).isEqualTo(8);
+    
assertThat(RedisHash.getPerStringOverhead()).isEqualTo(RedisHash.PER_OBJECT_OVERHEAD
 + 46);
+    
assertThat(RedisHash.getPerHashOverhead()).isEqualTo(RedisHash.PER_OBJECT_OVERHEAD
 + 116);
+  }

Review comment:
       This turns out to be hard. We can create a ReflectionObjectSizer in the 
constructor, and get the size of the object without any members added.
   
   Then we'd have to examine at least one member being added, and attempt to 
derive the per-object overhead as we added it. Except that it turns out that an 
empty HashSet doesn't allocate some storage. When you add the first object, you 
add both the object and the internal storage. So we could then add a second 
object, and based on the length attempt to figure out what the 'internal 
storage overhead' is...
   
   Anyway, it's not trivial. But we might have to do it because it looks like - 
no surprise and as feared - JVM v11 doesn't have the same overhead as v8.




-- 
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.

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


Reply via email to