dcapwell commented on code in PR #2104:
URL: https://github.com/apache/cassandra/pull/2104#discussion_r1110229559


##########
src/java/org/apache/cassandra/streaming/StreamManager.java:
##########
@@ -260,10 +269,20 @@ public StreamManager()
         logger.info("Storing streaming state for {} or for {} elements", 
duration, numElements);
         states = CacheBuilder.newBuilder()
                              .expireAfterWrite(duration.quantity(), 
duration.unit())
-                             .maximumSize(numElements)
+                             .maximumWeight(10 * 1024 *1024)
+                             .weigher(new streamingStateWeigher())
                              .build();
     }
 
+    private class streamingStateWeigher implements 
Weigher<TimeUUID,StreamingState>
+    {
+        public int weigh(TimeUUID key, StreamingState val) {

Review Comment:
   the `key` also costs memory, you should include that in the weight



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to