You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In PR #125, the class BufferPool was introduced to reduce buffer allocations and reuse already allocated buffers for de- and encryption. The affected buffers are part of "Chunk" records, which represent a contigous memory area in a file.
The third point (recycle on eviction) causes a severe bug. Imagine the following scenario:
Small size of chunk cache (e.g., 5)
Great number of concurrent reading threads (e.g., 100)
File spanning over several chunks
Random reading pattern leading to a low chunk cache hit rate
Low hit rate -> High number of cache evictions -> High recylce rate. But only because a chunk is evicted does not imply, the thread reading on the chunk has finished its operation. If the recycled buffer is selected to be filled again, the (still not finished) thread is reading wrong content.
The text was updated successfully, but these errors were encountered:
To recycle the data buffer of Chunks, a synchronization mechanism is needed which ensures:
Once the chunk is evicted from cache, no new accesses to data can be made
the chunk keeps track of accesses
Only if the last access is "closed", the buffer is recycled
This would add another layer of complexity, hence, for now we decided to keep it simple and just synchronize threads on methods in CleartextFileChannel.
In PR #125, the class
BufferPool
was introduced to reduce buffer allocations and reuse already allocated buffers for de- and encryption. The affected buffers are part of "Chunk" records, which represent a contigous memory area in a file.A buffer is recylced, when:
ChunkCache
:cryptofs/src/main/java/org/cryptomator/cryptofs/fh/ChunkCache.java
Lines 47 to 54 in ec170e7
The third point (recycle on eviction) causes a severe bug. Imagine the following scenario:
Low hit rate -> High number of cache evictions -> High recylce rate. But only because a chunk is evicted does not imply, the thread reading on the chunk has finished its operation. If the recycled buffer is selected to be filled again, the (still not finished) thread is reading wrong content.
The text was updated successfully, but these errors were encountered: