hpoenixf opened a new pull request, #24278:
URL: https://github.com/apache/kafka/pull/24278

   ### Summary
   
   Streams cache entries retain the raw source key and value, but the cache 
size estimate did not include those arrays. Large source records could 
therefore remain in the cache without triggering eviction at the configured 
limit.
   
   This change accounts for the raw byte arrays in `LRUCacheEntry`'s size 
snapshot. The shared `ProcessorRecordContext` estimate remains unchanged, 
preserving time-ordered buffer accounting.
   
   ### Trade-off for review
   
   The accounting is conservative: multiple cache entries can reference the 
same raw array, but each entry is charged separately. This can reduce effective 
cache capacity and cause earlier eviction. For indexed window stores, base and 
index entries can share raw references. I would appreciate feedback on whether 
this trade-off is acceptable for the initial fix or whether the index entry's 
retention should be addressed separately.
   
   In a synthetic cache-pressure comparison, the revised version retained less 
raw data but performed more evictions and underlying reads. Observed loop 
throughput varied by scenario; this is not a general production performance 
estimate.
   
   ### Testing
   
   - Added coverage for raw array sizes, cache eviction, shared references and 
accounting balance.
   - Added regression coverage for RocksDB and in-memory time-ordered buffer 
accounting, and indexed/non-indexed window-cache boundaries.
   - Ran targeted Streams tests and Checkstyle/Spotless checks on the revised 
code.
   - Reproduced the reported 400 × 1 MiB workload with a 32 MiB cache using 
TopologyTestDriver; checked the final data and cache-disabled control.
   
   The full Kafka test suite and live-broker integration tests were not 
completed on the final commit.
   
   Jira: https://issues.apache.org/jira/browse/KAFKA-21552
   
   Co-Authored-By: OpenAI GPT-6


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