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

Faster sequential IO (on compaction, streaming, etc)

    XMLWordPrintableJSON

    Details

      Description

      When node is doing a lot of sequencial IO (streaming, compacting, etc) a lot of CPU is lost in calls to RAF's int read() and DataOutputStream's write(int).
      This is because default implementations of readShort,readLong, etc as well as their matching write* are implemented with numerous calls of byte by byte read and write.
      This makes a lot of syscalls as well.

      A quick microbench shows than just reimplementation of these methods in either way gives 8x speed increase.

      A patch attached implements RandomAccessReader.read<Type> and SequencialWriter.write<Type> methods in more efficient way.
      I also eliminated some extra byte copies in CompositeType.split and ColumnNameHelper.maxComponents, which were on my profiler's hotspot method list during tests.

      A stress tests on my laptop show that this patch makes compaction 25-30% faster on uncompressed sstables and 15% faster for compressed ones.

      A deployment to production shows much less CPU load for compaction.
      (I attached a cpu load graph from one of our production, orange is niced CPU load - i.e. compaction; yellow is user - i.e. not compaction related tasks)

        Attachments

        1. 8630-FasterSequencialReadsAndWrites.txt
          28 kB
          Oleg Anastasyev
        2. cpu_load.png
          12 kB
          Oleg Anastasyev
        3. flight_recorder_001_files.tar.gz
          3.12 MB
          Stefania
        4. flight_recorder_002_files.tar.gz
          1.69 MB
          Stefania
        5. mmaped_uncomp_hotspot.png
          212 kB
          Stefania

          Issue Links

            Activity

              People

              • Assignee:
                Stefania Stefania
                Reporter:
                m0nstermind Oleg Anastasyev
                Authors:
                Stefania
                Reviewers:
                Ariel Weisberg
              • Votes:
                5 Vote for this issue
                Watchers:
                25 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: