The CachedStore wrapper class flushes on every put or putAll that dirties the cache. This seems rooted in a misunderstanding of LinkedHashMap.removeEldestEntry. This method is called on every put() or putAll() to the map, and the implementation in CachedStore flushes the dirty entries without first checking if the cache is at capacity. Interestingly, fixing this issue reveals another in org.apache.samza.storage.kv.TestKeyValueStores#putAndGet. This test unintentionally relies on the inefficient behavior in CachedStore to handle array keys. Specifically, even though different array instances can never get cache hits due to pass-by-reference semantics in the cache, the existing flushing behavior causes the arrays to get prematurely written to the store which has pass-by-value semantics.