smiklosovic commented on code in PR #3605:
URL: https://github.com/apache/cassandra/pull/3605#discussion_r1808694968
##########
src/java/org/apache/cassandra/cql3/QueryProcessor.java:
##########
@@ -149,6 +149,7 @@ public void preloadPreparedStatements()
clientState.setKeyspace(keyspace);
Prepared prepared = parseAndPrepare(query, clientState, false);
+ prepared.cacheEntrySize = measureCacheEntrySize(id, prepared);
Review Comment:
javadoc on weigher() says:
_Specifies the weigher to use in determining the weight of entries. Entry
weight is taken into consideration by maximumWeight(long) when determining
which entries to evict, and use of this method requires a corresponding call to
maximumWeight(long) prior to calling build. Weights are measured and recorded
when entries are inserted into or updated in the cache, and are thus
effectively static during the lifetime of a cache entry._
That is all true, but they think that key will / might be of different size.
We have keys of a constant size because it is md5sum so we just dont need to
take it into account, no?
however, `maximumWeight` docs says:
_Specifies the maximum weight of entries the cache may contain. Weight is
determined using the Weigher specified with weigher, and use of this method
requires a corresponding call to weigher prior to calling build.
Note that the cache may evict an entry before this limit is exceeded or
temporarily exceed the threshold while evicting. As the cache size grows close
to the maximum, the cache evicts entries that are less likely to be used again.
For example, the cache may evict an entry because it hasn't been used recently
or very often._
So I think that it will count on the size of the key upon eviction but we
can not we make that key of a constant size? What is MD5Digest producing? If
the output is same everytime on its size then we can just put there a number as
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]