Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-15229

Segregate Network and Chunk Cache BufferPools and Recirculate Partially Freed Chunks

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 4.0-beta3, 4.0
    • Local/Caching
    • None

    Description

      The BufferPool was never intended to be used for a ChunkCache, and we need to either change our behaviour to handle uncorrelated lifetimes or use something else. This is particularly important with the default chunk size for compressed sstables being reduced. If we address the problem, we should also utilise the BufferPool for native transport connections like we do for internode messaging, and reduce the number of pooling solutions we employ.
      Probably the best thing to do is to improve BufferPool’s behaviour when used for things with uncorrelated lifetimes, which essentially boils down to tracking those chunks that have not been freed and re-circulating them when we run out of completely free blocks. We should probably also permit instantiating separate BufferPool, so that we can insulate internode messaging from the ChunkCache, or at least have separate memory bounds for each, and only share fully-freed chunks.
      With these improvements we can also safely increase the BufferPool chunk size to 128KiB or 256KiB, to guarantee we can fit compressed pages and reduce the amount of global coordination and per-allocation overhead. We don’t need 1KiB granularity for allocations, nor 16 byte granularity for tiny allocations.


      Since CASSANDRA-5863, chunk cache is implemented to use buffer pool. When local pool is full, one of its chunks will be evicted and only put back to global pool when all buffers in the evicted chunk are released. But due to chunk cache, buffers can be held for long period of time, preventing evicted chunk to be recycled even though most of space in the evicted chunk are free.

      There two things need to be improved:
      1. Evicted chunk with free space should be recycled to global pool, even if it's not fully free. It's doable in 4.0.
      2. Reduce fragmentation caused by different buffer size. With #1, partially freed chunk will be available for allocation, but "holes" in the partially freed chunk are with different sizes. We should consider allocating fixed buffer size which is unlikely to fit in 4.0.

      Attachments

        1. 15229-count.png
          172 kB
          Zhao Yang
        2. 15229-recirculate-count.png
          162 kB
          Zhao Yang
        3. 15229-recirculate-hit-rate.png
          186 kB
          Zhao Yang
        4. 15229-recirculate-size.png
          136 kB
          Zhao Yang
        5. 15229-size.png
          130 kB
          Zhao Yang
        6. 15229-hit-rate.png
          204 kB
          Zhao Yang
        7. 15229-recirculate.png
          445 kB
          Zhao Yang
        8. 15229-direct.png
          333 kB
          Zhao Yang
        9. 15229-unsafe.png
          316 kB
          Zhao Yang

        Issue Links

          Activity

            People

              jasonstack Zhao Yang
              benedict Benedict Elliott Smith
              Zhao Yang
              Aleksey Yeschenko, Caleb Rackliffe
              Votes:
              0 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: