cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1179931 - in /cassandra/branches/cassandra-1.0.0: CHANGES.txt conf/cassandra.yaml src/java/org/apache/cassandra/config/Config.java src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Date Fri, 07 Oct 2011 03:49:00 GMT
Author: jbellis
Date: Fri Oct  7 03:48:59 2011
New Revision: 1179931

URL: http://svn.apache.org/viewvc?rev=1179931&view=rev
Log:
default hsha thrift server to cpu core count in rpc pool
patch by jbellis; reviewed by brandonwilliams for CASSANDRA-3329

Modified:
    cassandra/branches/cassandra-1.0.0/CHANGES.txt
    cassandra/branches/cassandra-1.0.0/conf/cassandra.yaml
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/Config.java
    cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/DatabaseDescriptor.java

Modified: cassandra/branches/cassandra-1.0.0/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/CHANGES.txt?rev=1179931&r1=1179930&r2=1179931&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/CHANGES.txt (original)
+++ cassandra/branches/cassandra-1.0.0/CHANGES.txt Fri Oct  7 03:48:59 2011
@@ -10,6 +10,7 @@
  * add estimated tasks to LeveledCompactionStrategy (CASSANDRA-3322)
  * avoid including compaction cache-warming in keycache stats (CASSANDRA-3325)
  * run compaction and hinted handoff threads at MIN_PRIORITY (CASSANDRA-3308)
+ * default hsha thrift server to cpu core count in rpc pool (CASSANDRA-3329)
 Fixes merged from 0.8 below:
  * Fix tool .bat files when CASSANDRA_HOME contains spaces (CASSANDRA-3258)
  * Force flush of status table when removing/updating token (CASSANDRA-3243)

Modified: cassandra/branches/cassandra-1.0.0/conf/cassandra.yaml
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/conf/cassandra.yaml?rev=1179931&r1=1179930&r2=1179931&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/conf/cassandra.yaml (original)
+++ cassandra/branches/cassandra-1.0.0/conf/cassandra.yaml Fri Oct  7 03:48:59 2011
@@ -193,35 +193,35 @@ rpc_port: 9160
 # enable or disable keepalive on rpc connections
 rpc_keepalive: true
 
-# Cassandra provides you with a variety of options for RPC Server
-# sync  -> Creates one thread per connection but with a configurable number of
-#           threads.  This can be expensive in memory used for thread stack for
-#           a large enough number of clients.  (Hence, connection pooling is
-#           very, very strongly recommended.)
+# Cassandra provides three options for the RPC Server:
+#
+# sync  -> One connection per thread in the rpc pool (see below).
+#          For a very large number of clients, memory will be your limiting
+#          factor; on a 64 bit JVM, 128KB is the minimum stack size per thread.
+#          Connection pooling is very, very strongly recommended.
 #
 # async -> Nonblocking server implementation with one thread to serve 
-#           rpc connections.  This is not recommended for high throughput use
-#           cases.
+#          rpc connections.  This is not recommended for high throughput use
+#          cases. Async has been tested to be about 50% slower than sync
+#          or hsha and is deprecated: it will be removed in the next major release.
+#
+# hsha  -> Stands for "half synchronous, half asynchronous." The rpc thread pool 
+#          (see below) is used to manage requests, but the threads are multiplexed
+#          across the different clients.
 #
-# hsha  -> half sync and half async implementation with configurable number
-#           of worker threads (For managing connections).  IO Management is
-#           done by a set of threads currently equal to the number of
-#           processors in the system. The number of threads in the threadpool
-#           is configured via rpc_min_threads and rpc_max_threads.  (Connection
-#           pooling is strongly recommended in this case too.) 
-
+# The default is sync because on Windows hsha is about 30% slower.  On Linux,
+# sync/hsha performance is about the same, with hsha of course using less memory.
 rpc_server_type: sync
 
 # Uncomment rpc_min|max|thread to set request pool size.
 # You would primarily set max for the sync server to safeguard against
 # misbehaved clients; if you do hit the max, Cassandra will block until one
-# disconnects before accepting more.  The defaults are min of 16 and max
+# disconnects before accepting more.  The defaults for sync are min of 16 and max
 # unlimited.
 # 
-# For the Hsha server, you would set the max so that a fair amount of resources
-# are provided to the other working threads on the server.
+# For the Hsha server, the min and max both default to the number of CPU cores.
 #
-# This configuration is not used for the async server.
+# This configuration is ignored by the async server.
 #
 # rpc_min_threads: 16
 # rpc_max_threads: 2048

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/Config.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/Config.java?rev=1179931&r1=1179930&r2=1179931&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/Config.java (original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/Config.java Fri
Oct  7 03:48:59 2011
@@ -69,8 +69,8 @@ public class Config
     public Integer rpc_port = 9160;
     public String rpc_server_type = "sync";
     public Boolean rpc_keepalive = true;
-    public Integer rpc_min_threads = 16;
-    public Integer rpc_max_threads = Integer.MAX_VALUE;
+    public Integer rpc_min_threads = null;
+    public Integer rpc_max_threads = null;
     public Integer rpc_send_buff_size_in_bytes;
     public Integer rpc_recv_buff_size_in_bytes;
 

Modified: cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=1179931&r1=1179930&r2=1179931&view=diff
==============================================================================
--- cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
(original)
+++ cassandra/branches/cassandra-1.0.0/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Fri Oct  7 03:48:59 2011
@@ -365,7 +365,15 @@ public class DatabaseDescriptor
 
             if (!CassandraDaemon.rpc_server_types.contains(conf.rpc_server_type.toLowerCase()))
                 throw new ConfigurationException("Unknown rpc_server_type: " + conf.rpc_server_type);
-            
+            if (conf.rpc_min_threads == null)
+                conf.rpc_min_threads = conf.rpc_server_type.toLowerCase().equals("hsha")
+                                     ? Runtime.getRuntime().availableProcessors()
+                                     : 16;
+            if (conf.rpc_max_threads == null)
+                conf.rpc_max_threads = conf.rpc_server_type.toLowerCase().equals("hsha")
+                                     ? Runtime.getRuntime().availableProcessors()
+                                     : Integer.MAX_VALUE;
+
             /* data file and commit log directories. they get created later, when they're
needed. */
             if (conf.commitlog_directory != null && conf.data_file_directories !=
null && conf.saved_caches_directory != null)
             {



Mime
View raw message