Cassandra
  1. Cassandra
  2. CASSANDRA-1007

Make memtable flush thresholds per-CF instead of global

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Fix Version/s: 0.7 beta 3
    • Component/s: None
    • Labels:
      None

      Description

      This is particularly useful in the scenario where you have a few CFs with a high volume of overwrite operations; increasing the memtable size/op count means that you can do the overwrite in memory before it ever hits disk. Once on disk compaction is much more work for the system.

      But, you don't want to give all your CFs that high of a threshold because the memory is better used elsewhere, and because it makes commitlog replay unnecessarily painful.

      1. 1007-3.txt
        65 kB
        Jon Hermes
      2. 1007-2.txt
        63 kB
        Jon Hermes
      3. 1007.txt
        60 kB
        Jon Hermes

        Activity

        Hide
        Hudson added a comment -

        Integrated in Cassandra #567 (See https://hudson.apache.org/hudson/job/Cassandra/567/)
        Make memtable flush thresholds per-CF instead of global. Patch by Jon Hermes, reviewed by brandonwilliams for CASSANDRA-1007

        Show
        Hudson added a comment - Integrated in Cassandra #567 (See https://hudson.apache.org/hudson/job/Cassandra/567/ ) Make memtable flush thresholds per-CF instead of global. Patch by Jon Hermes, reviewed by brandonwilliams for CASSANDRA-1007
        Hide
        Brandon Williams added a comment -

        Committed.

        Show
        Brandon Williams added a comment - Committed.
        Hide
        Jon Hermes added a comment -

        Updated the pretty print to not crash on usage. Now uses commons-lang ToStringBuilder instead.

        Show
        Jon Hermes added a comment - Updated the pretty print to not crash on usage. Now uses commons-lang ToStringBuilder instead.
        Hide
        Jon Hermes added a comment -

        Apparantly it's only broken for me.

        Show
        Jon Hermes added a comment - Apparantly it's only broken for me.
        Hide
        Jon Hermes added a comment -

        Updated but still broken.

        Show
        Jon Hermes added a comment - Updated but still broken.
        Hide
        Brandon Williams added a comment -

        Tests fail to compile:

        [javac] Compiling 80 source files to /srv/cassandra/build/test/classes
        [javac] /srv/cassandra/test/unit/org/apache/cassandra/db/DefsTest.java:686: cannot find symbol
        [javac] symbol : constructor CFMetaData(java.lang.String,java.lang.String,org.apache.cassandra.db.ColumnFamilyType,org.apache.cassandra.db.marshal.UTF8Type,<nulltype>,java.lang.String,int,boolean,double,int,int,org.apache.cassandra.db.marshal.BytesType,int,int,java.util.Map<byte[],org.apache.cassandra.config.ColumnDefinition>)
        [javac] location: class org.apache.cassandra.config.CFMetaData
        [javac] return new CFMetaData(ks,
        [javac] ^

        Show
        Brandon Williams added a comment - Tests fail to compile: [javac] Compiling 80 source files to /srv/cassandra/build/test/classes [javac] /srv/cassandra/test/unit/org/apache/cassandra/db/DefsTest.java:686: cannot find symbol [javac] symbol : constructor CFMetaData(java.lang.String,java.lang.String,org.apache.cassandra.db.ColumnFamilyType,org.apache.cassandra.db.marshal.UTF8Type,<nulltype>,java.lang.String,int,boolean,double,int,int,org.apache.cassandra.db.marshal.BytesType,int,int,java.util.Map<byte[],org.apache.cassandra.config.ColumnDefinition>) [javac] location: class org.apache.cassandra.config.CFMetaData [javac] return new CFMetaData(ks, [javac] ^
        Hide
        Jon Hermes added a comment - - edited

        Nope, tests are now crashing and burning.

        EDIT1:
        test/conf/cassandra.yaml was still using global memtable settings, so that was the first error.
        Now it's complaining that KSMetaData.deflate() isn't defined, which is broken.

        Show
        Jon Hermes added a comment - - edited Nope, tests are now crashing and burning. EDIT1: test/conf/cassandra.yaml was still using global memtable settings, so that was the first error. Now it's complaining that KSMetaData.deflate() isn't defined, which is broken.
        Hide
        Jon Hermes added a comment - - edited

        CHANGES:

        M conf/cassandra.yaml

        • Moves memtable settings into cf by demonstration.

        M src/java/org/apache/cassandra/db/Table.java
        M src/java/org/apache/cassandra/db/ColumnFamilyStore.java
        M src/java/org/apache/cassandra/db/Memtable.java

        • All the places where we previously asked for the global flushtime/size/ops now ask for it on a per-CF basis.

        M src/java/org/apache/cassandra/config/CFMetaData.java

        • The bulk of the changes. This adds the new field, handles all its constructors, into and out of avro/thrift, validation, and defaulting.

        M src/java/org/apache/cassandra/config/DatabaseDescriptor.java
        M src/java/org/apache/cassandra/config/Config.java
        M src/java/org/apache/cassandra/config/RawColumnFamily.java
        M src/java/org/apache/cassandra/config/Converter.java

        • Changed the way we read in the YAML, and updated the converter to handle 0.6 -> 0.7 transitions.

        M src/java/org/apache/cassandra/thrift/CassandraServer.java
        M src/java/org/apache/cassandra/avro/CassandraServer.java

        • Updated add/update CF to add new fields and validate them appropriately.

        M interface/cassandra.genavro
        M interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java
        M interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java
        M interface/cassandra.thrift

        • Adds three new fields to the CfDef, and adds the generated bindings.
        Show
        Jon Hermes added a comment - - edited CHANGES: M conf/cassandra.yaml Moves memtable settings into cf by demonstration. M src/java/org/apache/cassandra/db/Table.java M src/java/org/apache/cassandra/db/ColumnFamilyStore.java M src/java/org/apache/cassandra/db/Memtable.java All the places where we previously asked for the global flushtime/size/ops now ask for it on a per-CF basis. M src/java/org/apache/cassandra/config/CFMetaData.java The bulk of the changes. This adds the new field, handles all its constructors, into and out of avro/thrift, validation, and defaulting. M src/java/org/apache/cassandra/config/DatabaseDescriptor.java M src/java/org/apache/cassandra/config/Config.java M src/java/org/apache/cassandra/config/RawColumnFamily.java M src/java/org/apache/cassandra/config/Converter.java Changed the way we read in the YAML, and updated the converter to handle 0.6 -> 0.7 transitions. M src/java/org/apache/cassandra/thrift/CassandraServer.java M src/java/org/apache/cassandra/avro/CassandraServer.java Updated add/update CF to add new fields and validate them appropriately. M interface/cassandra.genavro M interface/thrift/gen-java/org/apache/cassandra/thrift/Constants.java M interface/thrift/gen-java/org/apache/cassandra/thrift/CfDef.java M interface/cassandra.thrift Adds three new fields to the CfDef, and adds the generated bindings.
        Hide
        Jonathan Ellis added a comment -

        Yes, but it should be a sane default (see CASSANDRA-1469) not an extra layer of configurability.

        Show
        Jonathan Ellis added a comment - Yes, but it should be a sane default (see CASSANDRA-1469 ) not an extra layer of configurability.
        Hide
        Matthew F. Dennis added a comment -

        does it make sense to still have a global default which is used when the flush thresholds are not specified in the CF (i.e. optionally set them per CF)?

        Show
        Matthew F. Dennis added a comment - does it make sense to still have a global default which is used when the flush thresholds are not specified in the CF (i.e. optionally set them per CF)?
        Hide
        Todd Blose added a comment -

        Yeah, got distracted with some things. I'll try and have it finished this weekend. Just have to rebase what I have with trunk

        Show
        Todd Blose added a comment - Yeah, got distracted with some things. I'll try and have it finished this weekend. Just have to rebase what I have with trunk
        Hide
        Jonathan Ellis added a comment -

        Still working on this, Todd?

        Show
        Jonathan Ellis added a comment - Still working on this, Todd?
        Hide
        Todd Blose added a comment -

        Working on this.

        Show
        Todd Blose added a comment - Working on this.

          People

          • Assignee:
            Jon Hermes
            Reporter:
            Jonathan Ellis
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development