Author: brandonwilliams
Date: Tue Oct  4 15:34:24 2011
New Revision: 1178833

URL: http://svn.apache.org/viewvc?rev=1178833&view=rev
Log:
Change default heap thresholds to max(min(1/2 ram, 1G), min(1/4 ram,
8GB)).
Patch by satishbabu, reviewed by brandonwilliams for CASSANDRA-3295

Modified:
    cassandra/branches/cassandra-1.0.0/CHANGES.txt
    cassandra/branches/cassandra-1.0.0/conf/cassandra-env.sh

Modified: cassandra/branches/cassandra-1.0.0/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/CHANGES.txt?rev=1178833&r1=1178832&r2=1178833&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/CHANGES.txt (original)
+++ cassandra/branches/cassandra-1.0.0/CHANGES.txt Tue Oct  4 15:34:24 2011
@@ -11,6 +11,8 @@
  * (Hadoop) check all interfaces for a match with split location
    before falling back to random replica (CASSANDRA-3211)
  * Fix stress COUNTER_GET option (CASSANDRA-3301)
+ * Change default heap thresholds to max(min(1/2 ram, 1G), min(1/4 ram, 8GB))
+   (CASSANDRA-3295)
 
 
 1.0.0-rc2

Modified: cassandra/branches/cassandra-1.0.0/conf/cassandra-env.sh
URL: 
http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/conf/cassandra-env.sh?rev=1178833&r1=1178832&r2=1178833&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/conf/cassandra-env.sh (original)
+++ cassandra/branches/cassandra-1.0.0/conf/cassandra-env.sh Tue Oct  4 
15:34:24 2011
@@ -40,7 +40,28 @@ calculate_heap_sizes()
             system_cpu_cores="2"
         ;;
     esac
-    max_heap_size_in_mb=`expr $system_memory_in_mb / 2`
+
+    # set max heap size based on the following
+    # max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB))
+    # calculate 1/2 ram and cap to 1024MB
+    # calculate 1/4 ram and cap to 8192MB
+    # pick the max
+    half_system_memory_in_mb=`expr $system_memory_in_mb / 2`
+    quarter_system_memory_in_mb=`expr $half_system_memory_in_mb / 2`
+    if [ "$half_system_memory_in_mb" -gt "1024" ]
+    then
+        half_system_memory_in_mb="1024"
+    fi
+    if [ "$quarter_system_memory_in_mb" -gt "8192" ]
+    then
+        quarter_system_memory_in_mb="8192"
+    fi
+    if [ "$half_system_memory_in_mb" -gt "$quarter_system_memory_in_mb" ]
+    then
+        max_heap_size_in_mb="$half_system_memory_in_mb"
+    else
+        max_heap_size_in_mb="$quarter_system_memory_in_mb"
+    fi
     MAX_HEAP_SIZE="${max_heap_size_in_mb}M"
 
     # Young gen: min(max_sensible_per_modern_cpu_core * num_cores, 1/4 * heap 
size)


Reply via email to