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

Faster UUID comparisons

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 0.7 beta 1
    • None
    • None

    Description

      As I explained on the mailing list, doing slice queries on CFs that are sorted by TimeUUIDType gets slower as the value of count increases. According to my profiles, this is largely due to the fact that ConcurrentSkipListMap calls the comparator very frequently, which is extremely inefficient. In order to compare two UUIDs, it has to materialize them both in to java.util.UUID objects which is quite slow. The more UUIDs to compare, the slower it is.

      Attached is a patch that compares UUIDs by extracting the timestamp directly from the byte[] representation. According to my tests, it's close to a 50% performance improvement.

      Attachments

        1. faster_uuid_compare.diff
          1 kB
          James Golick
        2. patch-v2-with-tests.diff
          4 kB
          James Golick
        3. faster-uuid-compare-v3.diff
          4 kB
          James Golick

        Issue Links

          Activity

            People

              jamesgolick James Golick
              jamesgolick James Golick
              James Golick
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: