Author: brandonwilliams Date: Fri Jul 29 14:21:06 2011 New Revision: 1152233
URL: http://svn.apache.org/viewvc?rev=1152233&view=rev Log: Add asynchronous and half-sync/half-async thrift servers. Patch by Vijay Parthasarathy, reviewed by brandonwilliams for CASSANDRA-1405 Added: cassandra/trunk/src/gen-java/ cassandra/trunk/src/gen-java/org/ cassandra/trunk/src/gen-java/org/apache/ cassandra/trunk/src/gen-java/org/apache/cassandra/ cassandra/trunk/src/gen-java/org/apache/cassandra/cli/ cassandra/trunk/src/gen-java/org/apache/cassandra/cli/Cli.tokens cassandra/trunk/src/gen-java/org/apache/cassandra/cli/CliLexer.java (with props) cassandra/trunk/src/gen-java/org/apache/cassandra/cli/CliParser.java (with props) cassandra/trunk/src/gen-java/org/apache/cassandra/cql/ cassandra/trunk/src/gen-java/org/apache/cassandra/cql/Cql.tokens cassandra/trunk/src/gen-java/org/apache/cassandra/cql/CqlLexer.java (with props) cassandra/trunk/src/gen-java/org/apache/cassandra/cql/CqlParser.java (with props) cassandra/trunk/src/java/org/apache/cassandra/service/SocketSessionManagementService.java (with props) cassandra/trunk/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java (with props) cassandra/trunk/src/java/org/apache/cassandra/thrift/CustomTNonBlockingServer.java (with props) cassandra/trunk/src/java/org/apache/cassandra/thrift/TCustomNonblockingServerSocket.java (with props) Modified: cassandra/trunk/conf/cassandra.yaml cassandra/trunk/conf/log4j-server.properties cassandra/trunk/src/java/org/apache/cassandra/concurrent/JMXEnabledThreadPoolExecutor.java cassandra/trunk/src/java/org/apache/cassandra/config/Config.java cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraDaemon.java cassandra/trunk/src/java/org/apache/cassandra/thrift/CassandraServer.java Modified: cassandra/trunk/conf/cassandra.yaml URL: http://svn.apache.org/viewvc/cassandra/trunk/conf/cassandra.yaml?rev=1152233&r1=1152232&r2=1152233&view=diff ============================================================================== --- cassandra/trunk/conf/cassandra.yaml (original) +++ cassandra/trunk/conf/cassandra.yaml Fri Jul 29 14:21:06 2011 @@ -203,16 +203,35 @@ rpc_port: 9160 # enable or disable keepalive on rpc connections rpc_keepalive: true -# Cassandra uses thread-per-client for client RPC. 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 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.) +# +# async -> Nonblocking server implementation with one thread to serve +# rpc connections. This is not recommended for high throughput use +# cases. +# +# 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.) + +rpc_server_type: sync + # Uncomment rpc_min|max|thread to set request pool size. -# You would primarily set max as a 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 unlimited. +# 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 +# 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. +# +# This configuration is not used for the async server. # # rpc_min_threads: 16 # rpc_max_threads: 2048 Modified: cassandra/trunk/conf/log4j-server.properties URL: http://svn.apache.org/viewvc/cassandra/trunk/conf/log4j-server.properties?rev=1152233&r1=1152232&r2=1152233&view=diff ============================================================================== --- cassandra/trunk/conf/log4j-server.properties (original) +++ cassandra/trunk/conf/log4j-server.properties Fri Jul 29 14:21:06 2011 @@ -39,3 +39,6 @@ log4j.appender.R.File=/var/log/cassandra #log4j.logger.org.apache.cassandra.db=DEBUG #log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG +# Adding this to avoid thrift logging disconnect errors. +log4j.logger.org.apache.thrift.server.TNonblockingServer=ERROR + Added: cassandra/trunk/src/gen-java/org/apache/cassandra/cli/Cli.tokens URL: http://svn.apache.org/viewvc/cassandra/trunk/src/gen-java/org/apache/cassandra/cli/Cli.tokens?rev=1152233&view=auto ============================================================================== --- cassandra/trunk/src/gen-java/org/apache/cassandra/cli/Cli.tokens (added) +++ cassandra/trunk/src/gen-java/org/apache/cassandra/cli/Cli.tokens Fri Jul 29 14:21:06 2011 @@ -0,0 +1,139 @@ +NODE_THRIFT_GET_WITH_CONDITIONS=15 +TTL=76 +NODE_SHOW_KEYSPACES=13 +CONDITION=38 +COUNT=67 +DecimalDigit=97 +Identifier=73 +NODE_UPDATE_COLUMN_FAMILY=26 +SingleStringCharacter=89 +NODE_USE_TABLE=7 +NODE_DEL_KEYSPACE=23 +CREATE=56 +NODE_CONNECT=4 +CONNECT=46 +INCR=64 +SingleEscapeCharacter=94 +FAMILY=59 +GET=62 +NODE_DESCRIBE_TABLE=5 +COMMENT=100 +SHOW=53 +ARRAY=40 +NODE_ADD_KEYSPACE=22 +EXIT=51 +NODE_THRIFT_DEL=18 +IntegerNegativeLiteral=80 +ON=78 +NODE_DROP_INDEX=31 +SEMICOLON=45 +KEYSPACES=54 +CONDITIONS=39 +FILE=84 +NODE_LIMIT=43 +LIST=68 +NODE_DESCRIBE_CLUSTER=6 +IP_ADDRESS=82 +NODE_THRIFT_SET=16 +NODE_NO_OP=10 +NODE_ID_LIST=33 +WS=99 +ASSUME=70 +NODE_THRIFT_COUNT=17 +DESCRIBE=49 +Alnum=88 +CharacterEscapeSequence=91 +NODE_SHOW_CLUSTER_NAME=11 +USE=48 +NODE_THRIFT_DECR=20 +FUNCTION_CALL=37 +EscapeSequence=90 +Letter=86 +DoubleLiteral=81 +HELP=47 +HexEscapeSequence=92 +NODE_EXIT=8 +LIMIT=85 +T__118=118 +T__119=119 +DEL=66 +T__116=116 +T__117=117 +T__114=114 +T__115=115 +NODE_LIST=27 +UPDATE=57 +NODE_UPDATE_KEYSPACE=25 +T__120=120 +AND=79 +NODE_NEW_CF_ACCESS=34 +CONSISTENCYLEVEL=71 +HexDigit=98 +QUIT=52 +NODE_TRUNCATE=28 +INDEX=61 +NODE_SHOW_VERSION=12 +T__107=107 +T__108=108 +NODE_NEW_KEYSPACE_ACCESS=35 +T__109=109 +T__103=103 +T__104=104 +TRUNCATE=69 +T__105=105 +T__106=106 +COLUMN=58 +T__111=111 +T__110=110 +T__113=113 +EscapeCharacter=96 +T__112=112 +PAIR=42 +NODE_CONSISTENCY_LEVEL=30 +WITH=75 +BY=77 +UnicodeEscapeSequence=93 +HASH=41 +SET=63 +T__102=102 +T__101=101 +Digit=87 +API_VERSION=55 +NODE_ASSUME=29 +CONVERT_TO_TYPE=36 +NODE_THRIFT_GET=14 +NODE_DEL_COLUMN_FAMILY=24 +NODE_KEY_RANGE=44 +KEYSPACE=50 +StringLiteral=74 +NODE_HELP=9 +CONFIG=83 +IntegerPositiveLiteral=72 +DROP=60 +NonEscapeCharacter=95 +DECR=65 +NODE_ADD_COLUMN_FAMILY=21 +NODE_THRIFT_INCR=19 +NODE_COLUMN_ACCESS=32 +'}'=117 +'>='=110 +'/'=101 +'LIMIT'=85 +'{'=116 +'>'=108 +'AS'=105 +'?'=104 +'<='=111 +'CLUSTER'=102 +'='=107 +'<'=109 +'('=119 +':'=118 +'['=113 +'WHERE'=106 +'CLUSTER NAME'=103 +','=114 +')'=120 +'.'=112 +'AND'=79 +']'=115