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

Are we sorting the bloom filters in memory to increase the probability of getting proper result instead of just avoiding the false positive?

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Low
    • Resolution: Not A Problem
    • Fix Version/s: 1.1.1
    • Component/s: None
    • Labels:

      Description

      I was just wondering if there is any logic for "which bloom filter should be checked first" to increase the probability of getting the result and not just minimizing the probability of false positive.

      ( Note: I have checked into the code and I am not talking about "Getting BloomFilter with the lowest practical false positive probability" OR "Getting smallest BloomFilter that can provide the given false positive probability rate for the given number of elements." )

      Consider following Scenario:

      1) In our Cassandra Cluster we are inserting 130 millions of rows on daily basis for single column family and practically we cant keep this data compacted always.(As the loading time is much and compaction may take too much time that could affect the schedule for loading of data for next day )
      2) We are inserting same rowkeys(values of all the 130 millions rows are same) everyday with different supercolumn.

      For date 20120101 we have
      
      super_CF= {row_1:{_super_column_20120101:{ col1 : val1, col2 : val2 }}
                 row_2:{_super_column_20120101:{ col1 : val3, col2 : val4 }}
                 row_3:{_super_column_20120101:{ col1 : val5, col2 : val6 }}
      } 
      and For date 20120102 it will be like
      
      super_CF= {row_1:{_super_column_20120102:{ col1 : val7, col2 : val8 }}
                 row_2:{_super_column_20120102:{ col1 : val9, col2 : val10 }}
                 row_3:{_super_column_20120102:{ col1 : val11, col2 : val12 }}
      } 
      
      Note that set of rowkeys is same for all the days only supercolumn changes
      

      3) So if we do not compact the data say for 30 days, each row key is present in 30 different sstables.
      4) So in worst case, even with 0 probability of false positive, there could be 30 unnecessary disk accesses.
      5) Because of this scenario we are experiencing extremely degraded read performance.

      Proposed solution:
      1) We can have some sorting of bloom-filters based on logic like the bloom filter of the sstable which resulted into successfully serving the read request will have higher priority over other bloom filters.
      I mean we will go for the bloom filter of the sstable which is most recently accessed and which successfully returned the requested columns.(MRU approach, As the probability of getting result from MRU sstable is greater).This way we can reduce the disk access.

      2) The point is we should have some sort of logic for sorting of bloom filters to boost the read performance in case where sstables are not yet compacted.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              samarthg1986 Samarth Gahire
              Reviewers:
              Jonathan Ellis
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 336h
                336h
                Remaining:
                Remaining Estimate - 336h
                336h
                Logged:
                Time Spent - Not Specified
                Not Specified