You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/10/13 07:14:41 UTC

[GitHub] [druid] zachjsh commented on a diff in pull request #13219: Improve global-cached-lookups metric reporting

zachjsh commented on code in PR #13219:
URL: https://github.com/apache/druid/pull/13219#discussion_r994245240


##########
extensions-core/lookups-cached-global/src/main/java/org/apache/druid/data/input/MapPopulator.java:
##########
@@ -245,7 +245,8 @@ static long getByteLengthOfObject(@Nullable Object o)
   {
     if (null != o) {
       if (o.getClass().getName().equals(STRING_CLASS_NAME)) {
-        return ((String) (o)).length();
+        // Each String object has ~40 bytes of overhead
+        return ((long) ((String) (o)).length() * Character.BYTES) + 40;

Review Comment:
   Thanks for pointing this out! The I think depends on the particular version of java and beyond that the particular distribution of it. In my testing I found 40 bytes to be a good estimate for overhead. Sometimes I find that its a bit less. Will leave as is unless you feel strongly about changing.



-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org