Más contenido relacionado La actualidad más candente (20) Similar a Apache Con NA 2013 - Cassandra Internals (20) Apache Con NA 2013 - Cassandra Internals1. APACHECON NORTH AMERICA 2013
CASSANDRA
INTERNALS
Aaron Morton
@aaronmorton
www.thelastpickle.com
Licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand License
2. About Me
Freelance Cassandra Consultant
Based in Wellington, New Zealand
Apache Cassandra Committer
Data Stax MVP for Apache Cassandra
9. Thrift Transport
//Custom TServer implementations
o.a.c.thrift.CustomTThreadPoolServer
o.a.c.thrift.CustomTNonBlockingServer
o.a.c.thrift.CustomTHsHaServer
11. Native Binary Transport
Beta in Cassandra 1.2
Uses Netty 3.5
Enabled with
start_native_transport
(Disabled by default)
12. o.a.c.transport.Server.run()
//Setup the Netty server
new ExecutionHandler()
new NioServerSocketChannelFactory()
ServerBootstrap.setPipelineFactory()
14. o.a.c.transport.messages
CredentialsMessage()
EventMessage()
ExecuteMessage()
PrepareMessage()
QueryMessage()
ResultMessage()
(And more...)
15. Messages
Defined in the Native Binary
Protocol
$SRC/doc/native_protocol.spec
18. JMX Management Beans
Registered with the names
such as
org.apache.cassandra.db:
type=StorageProxy
20. o.a.c.cli.CliMain.main()
// Connect to server to read input
this.connect()
this.evaluateFileStatements()
this.processStatementInteractive()
21. CLI Grammar
ANTLR Grammar
$SRC/src/java/o/a/c/cli/CLI.g
31. o.a.c.cql3.QueryProcessor
// Prepares and executes CQL3 statements
// Used by Thrift & Native transports
// Access control
// Input validation
// Returns transport.ResultMessage
39. Dynamo Layer
o.a.c.service
o.a.c.net
o.a.c.dht
o.a.c.locator
o.a.c.gms
o.a.c.stream
40. o.a.c.service.StorageProxy
// Cluster wide storage operations
// Select endpoints & check CL available
// Send messages to Stages
// Wait for response
// Store Hints
46. Dynamo Layer
o.a.c.service
o.a.c.net
o.a.c.dht
o.a.c.locator
o.a.c.gms
o.a.c.stream
52. o.a.c.net.MessageDeliveryTask.run()
// If dropable and rpc_timeout
MessagingService.incrementDroppedMessag
es(verb);
MessagingService.getVerbHandler(verb)
verbHandler.doVerb(message, id)
53. Dynamo Layer
o.a.c.service
o.a.c.net
o.a.c.dht
o.a.c.locator
o.a.c.gms
o.a.c.stream
56. Dynamo Layer
o.a.c.service
o.a.c.net
o.a.c.dht
o.a.c.locator
o.a.c.gms
o.a.c.stream
60. Dynamo Layer
o.a.c.service
o.a.c.net
o.a.c.dht
o.a.c.locator
o.a.c.gms
o.a.c.stream
64. o.a.c.gms.Gossiper.GossipTask.run()
// SYN -> ACK -> ACK2
makeRandomGossipDigest()
new GossipDigestSyn()
// Use MessagingService.sendOneWay()
Gossiper.doGossipToLiveMember()
Gossiper.doGossipToUnreachableMember()
Gossiper.doGossipToSeed()
68. Database Layer
o.a.c.concurrent
o.a.c.db
o.a.c.cache
o.a.c.io
o.a.c.trace
71. Database Layer
o.a.c.concurrent
o.a.c.db
o.a.c.cache
o.a.c.io
o.a.c.trace
72. o.a.c.db.Table
// Keyspace
open(String table)
getColumnFamilyStore(String cfName)
getRow(QueryFilter filter)
apply(RowMutation mutation,
boolean writeCommitLog)
73. o.a.c.db.ColumnFamilyStore
// Column Family
getColumnFamily(QueryFilter filter)
getTopLevelColumns(...)
apply(DecoratedKey key,
ColumnFamily columnFamily,
SecondaryIndexManager.Updater
indexer)
76. o.a.c.db.Memtable
put(DecoratedKey key,
ColumnFamily columnFamily,
SecondaryIndexManager.Updater
indexer)
flushAndSignal(CountDownLatch latch,
Future<ReplayPosition>
context)
81. Aaron Morton
@aaronmorton
www.thelastpickle.com
Licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand License