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

Our default buffer size for (uncompressed) buffered reads should be smaller, and based on the expected record size

    XMLWordPrintableJSON

    Details

      Description

      A large contributor to slower buffered reads than mmapped is likely that we read a full 64Kb at once, when average record sizes may be as low as 140 bytes on our stress tests. The TLB has only 128 entries on a modern core, and each read will touch 32 of these, meaning we are unlikely to almost ever be hitting the TLB, and will be incurring at least 30 unnecessary misses each time (as well as the other costs of larger than necessary accesses). When working with an SSD there is little to no benefit reading more than 4Kb at once, and in either case reading more data than we need is wasteful. So, I propose selecting a buffer size that is the next larger power of 2 than our average record size (with a minimum of 4Kb), so that we expect to read in one operation. I also propose that we create a pool of these buffers up-front, and that we ensure they are all exactly aligned to a virtual page, so that the source and target operations each touch exactly one virtual page per 4Kb of expected record size.

        Attachments

        1. screenshot-2.png
          150 kB
          Jim Plush
        2. screenshot-1.png
          306 kB
          Jim Plush
        3. 8894_tiny.yaml
          0.5 kB
          Stefania Alborghetti
        4. 8894_25pct.yaml
          0.5 kB
          Stefania Alborghetti
        5. 8894_5pct.yaml
          0.5 kB
          Stefania Alborghetti

          Issue Links

            Activity

              People

              • Assignee:
                stefania Stefania Alborghetti
                Reporter:
                benedict Benedict Elliott Smith
                Authors:
                Stefania Alborghetti
                Reviewers:
                Benedict Elliott Smith
              • Votes:
                2 Vote for this issue
                Watchers:
                13 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: