6. Cassandraâs peer to peer architecture,
linear scalability and multi data center
active-active deployment enable mission
critical eBay features for hundreds of
millions users every day.
Feng Qu, principal DBA at eBay Inc
19. âOne of the great things about
NoSQL is the ability to iterate
on one's data model as one's
business requires it.â
âEverything in one place is
convenient until it fails. If you
want to scale and be highly
available, use Cassandra.â
Matt Asay
MongoDB
Adrian Cockcroft
Battery Ventures
38. Atomic log appends with LWT
BEGIN BATCH
UPDATE log SET seq = 1
WHERE log_name = 'foo'
IF seq = 0;
INSERT INTO log (log_name, logged_at, entry)
VALUES ('foo', now(), 'test');
APPLY BATCH;
39. User defined types
CREATE TYPE address (
street text,
city text,
zip_code int,
phones set<text>
)
CREATE TABLE users (
id uuid PRIMARY KEY,
name text,
addresses map<text, frozen<address>>
)
SELECT id, name, addresses.city, addresses.phones FROM users;
id | name | addresses.city | addresses.phones
--------------------+----------------+--------------------------
63bf691f | jbellis | Austin | {'512-4567', '512-9999'}
40. Collection indexing
CREATE TABLE songs (
id uuid PRIMARY KEY,
artist text,
album text,
title text,
data blob,
tags set<text>
);
CREATE INDEX song_tags_idx ON songs(tags);
SELECT * FROM songs WHERE tags CONTAINS 'blues';
id | album | artist | tags | title
----------+---------------+-------------------+-----------------------+------------------
5027b27e | Country Blues | Lightnin' Hopkins | {'acoustic', 'blues'} | Worrying My Mind
57. The new row cache
CREATE TABLE notifications (
target_user text,
notification_id timeuuid,
source_id uuid,
source_type text,
activity text,
PRIMARY KEY (target_user, notification_id)
)
WITH CLUSTERING ORDER BY (notification_id DESC)
AND caching = 'rows_only'
AND rows_per_partition_to_cache = '3';
58. The new row cache
target_user notification_id source_id source_type activity
nick e1bd2bcb- d972b679- photo tom liked
nick 321998c- d972b679- photo jake commented
nick ea1c5d35- 88a049d5- user mike created account
nick 5321998c- 64613f27- photo tom commented
nick 07581439- 076eab7e- user tyler created account
mike 1c34467a- f04e309f- user tom created account
59. The new row cache
target_user notification_id source_id source_type activity
nick e1bd2bcb- d972b679- photo tom liked
nick 321998c- d972b679- photo jake commented
nick ea1c5d35- 88a049d5- user mike created account
nick 5321998c- 64613f27- photo tom commented
nick 07581439- 076eab7e- user tyler created account
mike 1c34467a- f04e309f- user tom created account
60. The new row cache
target_user notification_id source_id source_type activity
nick e1bd2bcb- d972b679- photo tom liked
nick 321998c- d972b679- photo jake commented
nick ea1c5d35- 88a049d5- user mike created account
nick 5321998c- 64613f27- photo tom commented
nick 07581439- 076eab7e- user tyler created account
mike 1c34467a- f04e309f- user tom created account