update default commitlog segment and total size
patch by jbellis; reviewed by vijay for CASSANDRA-4422


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/aa2c28ea
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/aa2c28ea
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/aa2c28ea

Branch: refs/heads/cassandra-1.1
Commit: aa2c28eadea7009361b46d95ee86a46fff291c0b
Parents: 9a8a890
Author: Jonathan Ellis <jbel...@apache.org>
Authored: Fri Jul 6 13:36:20 2012 -0500
Committer: Jonathan Ellis <jbel...@apache.org>
Committed: Fri Jul 6 14:26:58 2012 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    2 +
 conf/cassandra.yaml                                |   21 ++++++++++-----
 src/java/org/apache/cassandra/config/Config.java   |    4 +-
 .../cassandra/config/DatabaseDescriptor.java       |    6 ++++
 4 files changed, 24 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/aa2c28ea/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 4576480..1857671 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,6 @@
 1.1.3
+ * update default commitlog segment size to 32MB and total commitlog
+   size to 32/1024 MB for 32/64 bit JVMs, respectively (CASSANDRA-4422)
  * avoid using global partitioner to estimate ranges in index sstables
    (CASSANDRA-4403)
  * restore pre-CASSANDRA-3862 approach to removing expired tombstones

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aa2c28ea/conf/cassandra.yaml
----------------------------------------------------------------------
diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml
index d64e2c9..c4732db 100644
--- a/conf/cassandra.yaml
+++ b/conf/cassandra.yaml
@@ -155,13 +155,16 @@ saved_caches_directory: /var/lib/cassandra/saved_caches
 commitlog_sync: periodic
 commitlog_sync_period_in_ms: 10000
 
-# Configure  the Size of the individual Commitlog file. The 
-# default is 128 MB, which is almost always fine, but if you are
+# The size of the individual commitlog file segments.  A commitlog
+# segment may be archived, deleted, or recycled once all the data
+# in it (potentally from each columnfamily in the system) has been 
+# flushed to sstables.  
+#
+# The default size is 32, which is almost always fine, but if you are
 # archiving commitlog segments (see commitlog_archiving.properties),
-# then you probably want a finer granularity of archiving; 16 MB
+# then you probably want a finer granularity of archiving; 8 or 16 MB
 # is reasonable.
-#
-# commitlog_segment_size_in_mb: 128
+commitlog_segment_size_in_mb: 32
 
 # any class that implements the SeedProvider interface and has a
 # constructor that takes a Map<String, String> of parameters will do.
@@ -218,10 +221,14 @@ concurrent_writes: 32
 # If omitted, Cassandra will set it to 1/3 of the heap.
 # memtable_total_space_in_mb: 2048
 
-# Total space to use for commitlogs. 
+# Total space to use for commitlogs.  Since commitlog segments are
+# mmapped, and hence use up address space, the default size is 32
+# on 32-bit JVMs, and 1024 on 64-bit JVMs.
+#
 # If space gets above this value (it will round up to the next nearest
 # segment multiple), Cassandra will flush every dirty CF in the oldest
-# segment and remove it.
+# segment and remove it.  So a small total commitlog space will tend
+# to cause more flush activity on less-active columnfamilies.
 # commitlog_total_space_in_mb: 4096
 
 # This sets the amount of memtable flush writer threads.  These will

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aa2c28ea/src/java/org/apache/cassandra/config/Config.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/Config.java 
b/src/java/org/apache/cassandra/config/Config.java
index 658c6e6..f749db6 100644
--- a/src/java/org/apache/cassandra/config/Config.java
+++ b/src/java/org/apache/cassandra/config/Config.java
@@ -97,11 +97,11 @@ public class Config
 
     // Commit Log
     public String commitlog_directory;
-    public Integer commitlog_total_space_in_mb = 4096;
+    public Integer commitlog_total_space_in_mb;
     public CommitLogSync commitlog_sync;
     public Double commitlog_sync_batch_window_in_ms;
     public Integer commitlog_sync_period_in_ms;
-    public int commitlog_segment_size_in_mb = 128;
+    public int commitlog_segment_size_in_mb = 32;
 
     public String endpoint_snitch;
     public Boolean dynamic_snitch = true;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/aa2c28ea/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java 
b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index 3bafb72..8cb2cba 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -142,6 +142,9 @@ public class DatabaseDescriptor
             Yaml yaml = new Yaml(new Loader(constructor));
             conf = (Config)yaml.load(input);
 
+            if (!System.getProperty("os.arch").contains("64"))
+                logger.info("32bit JVM detected.  It is recommended to run 
Cassandra on a 64bit JVM for better performance.");
+
             if (conf.commitlog_sync == null)
             {
                 throw new ConfigurationException("Missing required directive 
CommitLogSync");
@@ -172,6 +175,9 @@ public class DatabaseDescriptor
                 logger.debug("Syncing log with a period of " + 
conf.commitlog_sync_period_in_ms);
             }
 
+            if (conf.commitlog_total_space_in_mb == null)
+                conf.commitlog_total_space_in_mb = 
System.getProperty("os.arch").contains("64") ? 1024 : 32;
+
             /* evaluate the DiskAccessMode Config directive, which also 
affects indexAccessMode selection */
             if (conf.disk_access_mode == Config.DiskAccessMode.auto)
             {

Reply via email to