SlideShare una empresa de Scribd logo
1 de 54
Cassandra 2.0
Lyuben Todorov
Cassandra Developer, DataStax
New Core Value
•
•
•
•

Massive Scalability
Performance
Reliability
Ease of Use
Binary Protocol
Binary Protocol
• Paging
• Batching prepared statements
• Improved parameterized statements
Cursors
Before - manual paging
• Have to keep track of position
• Complex for compound
primary keys

CREATE TABLE timeline (
...
PRIMARY KEY (uid, event_id)
);
SELECT * FROM timeline
WHERE (uid = :last_key
AND event_id > :last_event)
OR token(uid) >
token(:last_key)
LIMIT 100;
Cursors
Now
Statement s = new SimpleStatement(‚SELECT * FROM timeline‛);
s.setFetchSize(100);
// transparently fetches next pages
ResultSet result = session.execute(s);
for (Row row : result) {
dooStuff(row);
}
Cursors
Now
Statement s = new SimpleStatement(‚SELECT * FROM timeline‛);
s.setFetchSize(100);
// transparently fetches next pages
ResultSet result = session.execute(s);
for (Row row : result) {
dooStuff(row);
// x2
}
Batching PreparedStatement
PreparedStatement ps = session.prepare("INSERT INTO timeline
(id, event) VALUES(?, ?)");
BatchStatement batch = new BatchStatement();
batch.add(ps.bind(UUID.randomUUID(), event_1));
batch.add(ps.bind(UUID.randomUUID(), event_2));
session.execute(batch);
Simplified Parameterized Statements
session.execute(String cql, Object… values);
session.executeAsynch(String cql, Object… values);
session.execute("INSERT INTO timeline (uid, event)
VALUES (?, ?)", UUID.randomUUID(), event_x);
CQL3
CQL3
• SELECT DISTINCT partition_key;
CQL3
• SELECT DISTINCT partition_key;
• CREATE TABLE IF NOT EXISTS tbl_name;
CQL3
• SELECT DISTINCT partition_key;
• CREATE TABLE IF NOT EXISTS tbl_name;
• Aliases
SELECT event_id, dateOf(created_at) AS creation_date;
CQL3
• SELECT DISTINCT partition_key;
• CREATE TABLE IF NOT EXISTS tbl_name;
• Aliases
SELECT event_id, dateOf(created_at) AS creation_date

• ALTER TABLE tbl DROP column_name;
Lightweight Transactions
SESSION 1

SESSION 2

SELECT * FROM users
WHERE USERNAME = ‘lyuben’;

SELECT * FROM users
WHERE USERNAME = ‘lyuben’;

[empty resultset]

[empty resultset]

INSERT INTO users (...)
VALUES (‘lyubent’, ...)

INSERT INTO users (...)
VALUES (‘lyubent’, ...)

Last write wins.

User
exists?
If not,
create
user
Why not locking?
request
Client
(locks)

Coordinator
internal
request

Replica
Why not locking?
request
Client
(locks)

Coordinator
internal
request

X
Replica
Why not locking?
request

Coordinator

Client
(locks)

internal
request

store for replay

X
Replica
Why not locking?
request

Coordinator

Client
(locks)

internal
request
timeout
response

store for replay

X
Replica
Paxos
A family of protocols for solving consensus
in a network of unreliable processors.

Wikipedia
Paxos
• Immediate Consistency
• QUARUM based operations
• Unfinished operations’ states sent to leader
during prepare phase
• Paxos state is durable
LWT – Use when Appropriate
• Expensive – x4 round trips
• Eventual consistency is your friend
Lightweight Transactions – CQL
INSERT INTO USERS (username, email ...)
VALUES (‘lyuben’, ‘ltodorov@datastax.com’, ... )
IF NOT EXISTS;
Triggers
CREATE TRIGGER <name> ON <table> USING
<classname>;
Triggers
class MyTrigger implements ITrigger
{
public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily update)
{
...
}
}
Tracing
• Detailed view of what’s going on
• Great for debugging queries

cqlsh:test> TRACING ON;
Now tracing requests.
Tracing insert
cqlsh:test> INSERT INTO example (i, j) VALUES ('key', 7);
Tracing session: 69fc9cb0-4fb3-11e3-84ae-612d9c5d36d9
activity
| timestamp
| source
| source_elapsed
------------------------------------+--------------+-----------+---------------Determining replicas for mutation | 18:09:34,722 | 127.0.0.1 |
3507
Sending message to /127.0.0.2 | 18:09:34,724 | 127.0.0.1 |
5720
Acquiring switchLock read lock | 18:09:34,732 | 127.0.0.2 |
6043
Appending to commitlog | 18:09:34,732 | 127.0.0.2 |
6305
Adding to example memtable | 18:09:34,732 | 127.0.0.2 |
6373
Enqueuing response to /127.0.0.1 | 18:09:34,733 | 127.0.0.2 |
6978
Message received from /127.0.0.2 | 18:09:34,737 | 127.0.0.1 |
19055
Processing response from /127.0.0.2 | 18:09:34,738 | 127.0.0.1 |
19993
Request complete | 18:09:34,739 | 127.0.0.1 |
20322
Tracing tombstone
cqlsh:test> SELECT * FROM example;
Tracing session: 79d55380-4fb7-11e3-9ac8-612d9c5d36d9
activity
| timestamp
| source
| source_elapsed
-----------------------------------------+--------------+-----------+--------------...
Sending message to /127.0.0.2 | 18:38:39,291 | 127.0.0.1 |
601
Read 10 live and 100000 tombstoned cells | 18:38:39,291 | 127.0.0.2 |
31655
Scanned 1 rows and matched 1 | 18:38:39,292 | 127.0.0.2 |
31693
Message received from /127.0.0.2 | 18:38:39,292 | 127.0.0.1 |
33150
Enqueuing response to /127.0.0.1 | 18:38:39,292 | 127.0.0.2 |
33724
Processing response from /127.0.0.2 | 18:38:39,292 | 127.0.0.1 |
34704
Sending message to /127.0.0.1 | 18:38:39,292 | 127.0.0.2 |
35220
...
Row Marker
CREATE TABLE tbl (
key int,
a text,
b text,
PRIMARY KEY (key)
);
UPDATE tbl SET a=null, b=null WHERE key=1;
DELETE FROM tbl where key=2;
Row Marker (JSON format)
[
{"key": "00000001","columns": [["","",1384716960173000],
["a","52891aa0",1384716960173000,"d"],
["b","52891aa0",1384716960173000,"d"]]
},
{"key": "00000002","columns": []}
]

Retreied via sstable2json
Rapid Read Protection
• Configurable per-table.
• Reduces occurrences of read timeouts in
overloaded / crashed replicas.
• Enabled by default in 2.0.2.
Rapid Read Protection
Rapid Read Protection
Configuring rapid read protection
# retry if request takes longer than 10ms
ALTER TABLE example WITH speculative_retry = '10ms';
# retry if request takes longer then 99% of requests
ALTER TABLE example WITH speculative_retry = '99percentile';
Going Off Heap
Managed by GC
Stack

Heap

Not Managed by GC
Native
Going Off Heap
• Bloom Filters
1 - 2GB per billion entries
Going Off Heap
• Bloom Filters
1 - 2GB per billion entries
• Compression Offsets
1 - 3GB per TB of compressed data
Going Off Heap
• Bloom Filters
1 - 2GB per billion entries
• Compression Offsets
1 - 3GB per TB of compressed data
• Partition Summary
Depends on # of rows per partition
Compaction
Leveled

Row fragments

Size Tiered
Leveled Compaction Strategy
Happy LCS
Sad LCS
STCS in Level 0
Coming up
• Secondary indexes for collections (4511)
Coming up
• Secondary indexes for collections (4511)
CREATE TABLE image (
id UUID,
tags set<text>,
PRIMARY KEY(id)
);

SELECT * FROM image WHERE tags CONTAINS ’sunny’;
image_id
| tags
--------------------------------------+------------------------------1a3ab520-5177-11e3-91ae-612d9c5d36d9 | {'beach', 'holiday', 'sunny'}
2617d120-5177-11e3-91ae-612d9c5d36d9 | {'mountains', 'sunny'}
Coming up
• Secondary indexes for collections (4511)
• More efficient repairs (5351)
Coming up
• Secondary indexes for collections (4511)
• More efficient repairs (5351)
STCS
Repair

Compaction
Coming up
• Secondary indexes for collections (4511)
• More efficient repairs (5351)
LCS
L0
L0
L1
L2
Coming up
• Secondary indexes for collections (4511)
• More efficient repairs (5351)
• Custom types (5590)
Coming up
• Secondary indexes for collections (4511)
• More efficient repairs (5351)
• Custom types (5590)
CREATE TYPE address (
street text,
city text,
zip_code int,
phones set<text>
)
Key

UTF8Type

UTF8Type

CREATE TABLE users (
id uuid PRIMARY KEY,
name text,
addresses map<int, address>
)
INT32Type

MapType ( Int32Type, Address)
Coming up
•
•
•
•

Secondary indexes for collections (4511)
More efficient repairs (5351)
Custom types (5590)
CQL aggregate functions (4914)
Coming up
•
•
•
•

Secondary indexes for collections (4511)
More efficient repairs (5351)
Custom types (5590)
CQL aggregate functions (4914)
– AVG, MIN, MAX, MEAN, SUM, etc.

SELECT sum(salary) FROM employee where country='UK';
Coming up
•
•
•
•
•

Secondary indexes for collections (4511)
More efficient repairs (5351)
Custom types (5590)
CQL aggregate functions (4914)
Many more!
DataStax Ac*ademy
Free online cassandra training!
https://datastaxacademy.elogiclearning.com/
Dun ddd

Más contenido relacionado

La actualidad más candente

How To Crack RSA Netrek Binary Verification System
How To Crack RSA Netrek Binary Verification SystemHow To Crack RSA Netrek Binary Verification System
How To Crack RSA Netrek Binary Verification System
Jay Corrales
 
Axis2 client memory leak
Axis2 client memory leakAxis2 client memory leak
Axis2 client memory leak
feng lee
 
Introduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache CassandraIntroduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache Cassandra
DataStax Academy
 

La actualidad más candente (20)

[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
 
Apache Cassandra & Data Modeling
Apache Cassandra & Data ModelingApache Cassandra & Data Modeling
Apache Cassandra & Data Modeling
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache Cassandra
 
Lab1-DB-Cassandra
Lab1-DB-CassandraLab1-DB-Cassandra
Lab1-DB-Cassandra
 
How To Crack RSA Netrek Binary Verification System
How To Crack RSA Netrek Binary Verification SystemHow To Crack RSA Netrek Binary Verification System
How To Crack RSA Netrek Binary Verification System
 
ClickHouse Features for Advanced Users, by Aleksei Milovidov
ClickHouse Features for Advanced Users, by Aleksei MilovidovClickHouse Features for Advanced Users, by Aleksei Milovidov
ClickHouse Features for Advanced Users, by Aleksei Milovidov
 
PostgreSQL: Advanced indexing
PostgreSQL: Advanced indexingPostgreSQL: Advanced indexing
PostgreSQL: Advanced indexing
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
 
Cassandra Day Chicago 2015: Advanced Data Modeling
Cassandra Day Chicago 2015: Advanced Data ModelingCassandra Day Chicago 2015: Advanced Data Modeling
Cassandra Day Chicago 2015: Advanced Data Modeling
 
Using PostgreSQL statistics to optimize performance
Using PostgreSQL statistics to optimize performance Using PostgreSQL statistics to optimize performance
Using PostgreSQL statistics to optimize performance
 
On Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data TypesOn Beyond (PostgreSQL) Data Types
On Beyond (PostgreSQL) Data Types
 
Time Series Analysis for Network Secruity
Time Series Analysis for Network SecruityTime Series Analysis for Network Secruity
Time Series Analysis for Network Secruity
 
Axis2 client memory leak
Axis2 client memory leakAxis2 client memory leak
Axis2 client memory leak
 
Cassandra Summit 2015
Cassandra Summit 2015Cassandra Summit 2015
Cassandra Summit 2015
 
Introduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache CassandraIntroduction to Data Modeling with Apache Cassandra
Introduction to Data Modeling with Apache Cassandra
 
Modern query optimisation features in MySQL 8.
Modern query optimisation features in MySQL 8.Modern query optimisation features in MySQL 8.
Modern query optimisation features in MySQL 8.
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
 
Postgres can do THAT?
Postgres can do THAT?Postgres can do THAT?
Postgres can do THAT?
 
Geospatial and bitemporal search in cassandra with pluggable lucene index
Geospatial and bitemporal search in cassandra with pluggable lucene indexGeospatial and bitemporal search in cassandra with pluggable lucene index
Geospatial and bitemporal search in cassandra with pluggable lucene index
 
Apache Cassandra, part 2 – data model example, machinery
Apache Cassandra, part 2 – data model example, machineryApache Cassandra, part 2 – data model example, machinery
Apache Cassandra, part 2 – data model example, machinery
 

Destacado

Living In Tel Aviv-Yafo
Living In Tel Aviv-YafoLiving In Tel Aviv-Yafo
Living In Tel Aviv-Yafo
noambarlevy
 
7331642 ryle-gilbert-el-concepto-de-lo-mental
7331642 ryle-gilbert-el-concepto-de-lo-mental7331642 ryle-gilbert-el-concepto-de-lo-mental
7331642 ryle-gilbert-el-concepto-de-lo-mental
colsandino
 
Adv420.v spres
Adv420.v spresAdv420.v spres
Adv420.v spres
kristof4
 
Urban Outfitters Festival Romance
Urban Outfitters Festival RomanceUrban Outfitters Festival Romance
Urban Outfitters Festival Romance
Amanda Furtaw
 
Cybersecurity in the Cognitive Era: Priming Your Digital Immune System
Cybersecurity in the Cognitive Era: Priming Your Digital Immune SystemCybersecurity in the Cognitive Era: Priming Your Digital Immune System
Cybersecurity in the Cognitive Era: Priming Your Digital Immune System
IBM Security
 

Destacado (12)

Living In Tel Aviv-Yafo
Living In Tel Aviv-YafoLiving In Tel Aviv-Yafo
Living In Tel Aviv-Yafo
 
Frisk och stark på jobbet
Frisk och stark på jobbetFrisk och stark på jobbet
Frisk och stark på jobbet
 
7331642 ryle-gilbert-el-concepto-de-lo-mental
7331642 ryle-gilbert-el-concepto-de-lo-mental7331642 ryle-gilbert-el-concepto-de-lo-mental
7331642 ryle-gilbert-el-concepto-de-lo-mental
 
Gametogenesis
GametogenesisGametogenesis
Gametogenesis
 
Adv420.v spres
Adv420.v spresAdv420.v spres
Adv420.v spres
 
Malformaciones geneticas
Malformaciones geneticasMalformaciones geneticas
Malformaciones geneticas
 
Atelier 4 e-reputation
Atelier 4   e-reputationAtelier 4   e-reputation
Atelier 4 e-reputation
 
Final presentation
Final presentationFinal presentation
Final presentation
 
The underground railroad
The underground railroadThe underground railroad
The underground railroad
 
Jd13 nl responsivelowhangingfruit
Jd13 nl responsivelowhangingfruitJd13 nl responsivelowhangingfruit
Jd13 nl responsivelowhangingfruit
 
Urban Outfitters Festival Romance
Urban Outfitters Festival RomanceUrban Outfitters Festival Romance
Urban Outfitters Festival Romance
 
Cybersecurity in the Cognitive Era: Priming Your Digital Immune System
Cybersecurity in the Cognitive Era: Priming Your Digital Immune SystemCybersecurity in the Cognitive Era: Priming Your Digital Immune System
Cybersecurity in the Cognitive Era: Priming Your Digital Immune System
 

Similar a Dun ddd

Mutant Tests Too: The SQL
Mutant Tests Too: The SQLMutant Tests Too: The SQL
Mutant Tests Too: The SQL
DataWorks Summit
 

Similar a Dun ddd (20)

Apache Cassandra Data Modeling with Travis Price
Apache Cassandra Data Modeling with Travis PriceApache Cassandra Data Modeling with Travis Price
Apache Cassandra Data Modeling with Travis Price
 
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
Linuxfest Northwest 2022 - MySQL 8.0 Nre FeaturesLinuxfest Northwest 2022 - MySQL 8.0 Nre Features
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
 
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
 
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
What's New in MariaDB Server 10.2 and MariaDB MaxScale 2.1
 
DEF CON 27 -OMER GULL - select code execution from using sq lite
DEF CON 27 -OMER GULL - select code execution from using sq liteDEF CON 27 -OMER GULL - select code execution from using sq lite
DEF CON 27 -OMER GULL - select code execution from using sq lite
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
 
Performance improvements in PostgreSQL 9.5 and beyond
Performance improvements in PostgreSQL 9.5 and beyondPerformance improvements in PostgreSQL 9.5 and beyond
Performance improvements in PostgreSQL 9.5 and beyond
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
 
Checking clustering factor to detect row migration
Checking clustering factor to detect row migrationChecking clustering factor to detect row migration
Checking clustering factor to detect row migration
 
Optimizer in oracle 11g by wwf from ebay COC
Optimizer in oracle 11g by wwf from ebay COCOptimizer in oracle 11g by wwf from ebay COC
Optimizer in oracle 11g by wwf from ebay COC
 
Mutant Tests Too: The SQL
Mutant Tests Too: The SQLMutant Tests Too: The SQL
Mutant Tests Too: The SQL
 
Apache Cassandra - Data modelling
Apache Cassandra - Data modellingApache Cassandra - Data modelling
Apache Cassandra - Data modelling
 
Dbms lab Manual
Dbms lab ManualDbms lab Manual
Dbms lab Manual
 
What's new in Cassandra 2.0
What's new in Cassandra 2.0What's new in Cassandra 2.0
What's new in Cassandra 2.0
 
Just in time (series) - KairosDB
Just in time (series) - KairosDBJust in time (series) - KairosDB
Just in time (series) - KairosDB
 
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_103 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
03 2017Emea_RoadshowMilan-WhatsNew-Mariadbserver10_2andmaxscale 2_1
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
 
New Tuning Features in Oracle 11g - How to make your database as boring as po...
New Tuning Features in Oracle 11g - How to make your database as boring as po...New Tuning Features in Oracle 11g - How to make your database as boring as po...
New Tuning Features in Oracle 11g - How to make your database as boring as po...
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
How Database Convergence Impacts the Coming Decades of Data Management
How Database Convergence Impacts the Coming Decades of Data ManagementHow Database Convergence Impacts the Coming Decades of Data Management
How Database Convergence Impacts the Coming Decades of Data Management
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Dun ddd

  • 2. New Core Value • • • • Massive Scalability Performance Reliability Ease of Use
  • 4. Binary Protocol • Paging • Batching prepared statements • Improved parameterized statements
  • 5. Cursors Before - manual paging • Have to keep track of position • Complex for compound primary keys CREATE TABLE timeline ( ... PRIMARY KEY (uid, event_id) ); SELECT * FROM timeline WHERE (uid = :last_key AND event_id > :last_event) OR token(uid) > token(:last_key) LIMIT 100;
  • 6. Cursors Now Statement s = new SimpleStatement(‚SELECT * FROM timeline‛); s.setFetchSize(100); // transparently fetches next pages ResultSet result = session.execute(s); for (Row row : result) { dooStuff(row); }
  • 7. Cursors Now Statement s = new SimpleStatement(‚SELECT * FROM timeline‛); s.setFetchSize(100); // transparently fetches next pages ResultSet result = session.execute(s); for (Row row : result) { dooStuff(row); // x2 }
  • 8. Batching PreparedStatement PreparedStatement ps = session.prepare("INSERT INTO timeline (id, event) VALUES(?, ?)"); BatchStatement batch = new BatchStatement(); batch.add(ps.bind(UUID.randomUUID(), event_1)); batch.add(ps.bind(UUID.randomUUID(), event_2)); session.execute(batch);
  • 9. Simplified Parameterized Statements session.execute(String cql, Object… values); session.executeAsynch(String cql, Object… values); session.execute("INSERT INTO timeline (uid, event) VALUES (?, ?)", UUID.randomUUID(), event_x);
  • 10. CQL3
  • 11. CQL3 • SELECT DISTINCT partition_key;
  • 12. CQL3 • SELECT DISTINCT partition_key; • CREATE TABLE IF NOT EXISTS tbl_name;
  • 13. CQL3 • SELECT DISTINCT partition_key; • CREATE TABLE IF NOT EXISTS tbl_name; • Aliases SELECT event_id, dateOf(created_at) AS creation_date;
  • 14. CQL3 • SELECT DISTINCT partition_key; • CREATE TABLE IF NOT EXISTS tbl_name; • Aliases SELECT event_id, dateOf(created_at) AS creation_date • ALTER TABLE tbl DROP column_name;
  • 15. Lightweight Transactions SESSION 1 SESSION 2 SELECT * FROM users WHERE USERNAME = ‘lyuben’; SELECT * FROM users WHERE USERNAME = ‘lyuben’; [empty resultset] [empty resultset] INSERT INTO users (...) VALUES (‘lyubent’, ...) INSERT INTO users (...) VALUES (‘lyubent’, ...) Last write wins. User exists? If not, create user
  • 20. Paxos A family of protocols for solving consensus in a network of unreliable processors. Wikipedia
  • 21. Paxos • Immediate Consistency • QUARUM based operations • Unfinished operations’ states sent to leader during prepare phase • Paxos state is durable
  • 22. LWT – Use when Appropriate • Expensive – x4 round trips • Eventual consistency is your friend
  • 23. Lightweight Transactions – CQL INSERT INTO USERS (username, email ...) VALUES (‘lyuben’, ‘ltodorov@datastax.com’, ... ) IF NOT EXISTS;
  • 24. Triggers CREATE TRIGGER <name> ON <table> USING <classname>;
  • 25. Triggers class MyTrigger implements ITrigger { public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily update) { ... } }
  • 26. Tracing • Detailed view of what’s going on • Great for debugging queries cqlsh:test> TRACING ON; Now tracing requests.
  • 27. Tracing insert cqlsh:test> INSERT INTO example (i, j) VALUES ('key', 7); Tracing session: 69fc9cb0-4fb3-11e3-84ae-612d9c5d36d9 activity | timestamp | source | source_elapsed ------------------------------------+--------------+-----------+---------------Determining replicas for mutation | 18:09:34,722 | 127.0.0.1 | 3507 Sending message to /127.0.0.2 | 18:09:34,724 | 127.0.0.1 | 5720 Acquiring switchLock read lock | 18:09:34,732 | 127.0.0.2 | 6043 Appending to commitlog | 18:09:34,732 | 127.0.0.2 | 6305 Adding to example memtable | 18:09:34,732 | 127.0.0.2 | 6373 Enqueuing response to /127.0.0.1 | 18:09:34,733 | 127.0.0.2 | 6978 Message received from /127.0.0.2 | 18:09:34,737 | 127.0.0.1 | 19055 Processing response from /127.0.0.2 | 18:09:34,738 | 127.0.0.1 | 19993 Request complete | 18:09:34,739 | 127.0.0.1 | 20322
  • 28. Tracing tombstone cqlsh:test> SELECT * FROM example; Tracing session: 79d55380-4fb7-11e3-9ac8-612d9c5d36d9 activity | timestamp | source | source_elapsed -----------------------------------------+--------------+-----------+--------------... Sending message to /127.0.0.2 | 18:38:39,291 | 127.0.0.1 | 601 Read 10 live and 100000 tombstoned cells | 18:38:39,291 | 127.0.0.2 | 31655 Scanned 1 rows and matched 1 | 18:38:39,292 | 127.0.0.2 | 31693 Message received from /127.0.0.2 | 18:38:39,292 | 127.0.0.1 | 33150 Enqueuing response to /127.0.0.1 | 18:38:39,292 | 127.0.0.2 | 33724 Processing response from /127.0.0.2 | 18:38:39,292 | 127.0.0.1 | 34704 Sending message to /127.0.0.1 | 18:38:39,292 | 127.0.0.2 | 35220 ...
  • 29. Row Marker CREATE TABLE tbl ( key int, a text, b text, PRIMARY KEY (key) ); UPDATE tbl SET a=null, b=null WHERE key=1; DELETE FROM tbl where key=2;
  • 30. Row Marker (JSON format) [ {"key": "00000001","columns": [["","",1384716960173000], ["a","52891aa0",1384716960173000,"d"], ["b","52891aa0",1384716960173000,"d"]] }, {"key": "00000002","columns": []} ] Retreied via sstable2json
  • 31. Rapid Read Protection • Configurable per-table. • Reduces occurrences of read timeouts in overloaded / crashed replicas. • Enabled by default in 2.0.2.
  • 33. Rapid Read Protection Configuring rapid read protection # retry if request takes longer than 10ms ALTER TABLE example WITH speculative_retry = '10ms'; # retry if request takes longer then 99% of requests ALTER TABLE example WITH speculative_retry = '99percentile';
  • 34. Going Off Heap Managed by GC Stack Heap Not Managed by GC Native
  • 35. Going Off Heap • Bloom Filters 1 - 2GB per billion entries
  • 36. Going Off Heap • Bloom Filters 1 - 2GB per billion entries • Compression Offsets 1 - 3GB per TB of compressed data
  • 37. Going Off Heap • Bloom Filters 1 - 2GB per billion entries • Compression Offsets 1 - 3GB per TB of compressed data • Partition Summary Depends on # of rows per partition
  • 43. Coming up • Secondary indexes for collections (4511)
  • 44. Coming up • Secondary indexes for collections (4511) CREATE TABLE image ( id UUID, tags set<text>, PRIMARY KEY(id) ); SELECT * FROM image WHERE tags CONTAINS ’sunny’; image_id | tags --------------------------------------+------------------------------1a3ab520-5177-11e3-91ae-612d9c5d36d9 | {'beach', 'holiday', 'sunny'} 2617d120-5177-11e3-91ae-612d9c5d36d9 | {'mountains', 'sunny'}
  • 45. Coming up • Secondary indexes for collections (4511) • More efficient repairs (5351)
  • 46. Coming up • Secondary indexes for collections (4511) • More efficient repairs (5351) STCS Repair Compaction
  • 47. Coming up • Secondary indexes for collections (4511) • More efficient repairs (5351) LCS L0 L0 L1 L2
  • 48. Coming up • Secondary indexes for collections (4511) • More efficient repairs (5351) • Custom types (5590)
  • 49. Coming up • Secondary indexes for collections (4511) • More efficient repairs (5351) • Custom types (5590) CREATE TYPE address ( street text, city text, zip_code int, phones set<text> ) Key UTF8Type UTF8Type CREATE TABLE users ( id uuid PRIMARY KEY, name text, addresses map<int, address> ) INT32Type MapType ( Int32Type, Address)
  • 50. Coming up • • • • Secondary indexes for collections (4511) More efficient repairs (5351) Custom types (5590) CQL aggregate functions (4914)
  • 51. Coming up • • • • Secondary indexes for collections (4511) More efficient repairs (5351) Custom types (5590) CQL aggregate functions (4914) – AVG, MIN, MAX, MEAN, SUM, etc. SELECT sum(salary) FROM employee where country='UK';
  • 52. Coming up • • • • • Secondary indexes for collections (4511) More efficient repairs (5351) Custom types (5590) CQL aggregate functions (4914) Many more!
  • 53. DataStax Ac*ademy Free online cassandra training! https://datastaxacademy.elogiclearning.com/