SlideShare una empresa de Scribd logo
1 de 23
Descargar para leer sin conexión
Cassandra 
Delivering Christmas
gifts in France since
2012
Me, myself and I
Puppet
Software

Cassandr
a

Matthie
u
Nantern

@mNantern

mnantern@xebia.fr

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

2
From Mysql to Cassandra
Overview

1

2

3

4

Context

Why ?

How ?

Go Live!

Delivering parcels
at La Poste

Why do we need
another system ?
Project’s
constraints and
alternatives

How we build our
solution. Using C*
with PHP and
managing TTL

Provisioning
servers.
Performance and
resilience testing

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

3
La Poste
Mail services
Parcels distribution
More than 250 000 employees 
70 000 postmen delivering
parcels

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

4
La Poste
Postman’s tour
(1) A postman scans every parcels
Print

Scan

(2) He prints his list of parcels
(3) He distributes the parcels 
(4) He scans every remaining parcels

Scan

Distribute

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

5
From MySQL to C*

Why ?
Why do we need another system ?

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

7
Project’s constraints
Max 13ms per call
15 days of retention for data
Easy to deploy and operate
Easy to scale for years to come

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

8
From MySQL to C*

How ?
Data Modeling

Id

Data

key1 key2 key3

Id

Data

Search1 Search2

1

<Xml>

k11

k21

k31

1

<Xml>

k11k31 k21k11

2

<Xml>

k12

k22

k32

2

<Xml>

k12k32 k22k12

3

<Xml>

k13

k23

k33

3

<Xml>

k13k33 k23k13

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

10
Using Cassandra with PHP
For dummies

$pool = new ConnectionPool("Keyspace1", array("cass:9160")
$column_family = new ColumnFamily($pool,
'ColumnFamily1');
$column_family->insert('row_key', array('name1' =>
'val1', 'name2' => 'val2'));
$column_family->get('row_key');

$row1 = array('name1' => 'val1', 'name2' => 'val2');
$row2 = array('foo' => 'bar');
$column_family->batch_insert(array('row1' => $row1,
'row2' => $row2); | http://blog.xebia.fr | #CassandraEU
www.xebia.fr
|

Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

11
Using Cassandra with PHP
Level 2

$index_exp=CassandraUtil::create_index_expression($inde
xName, $indexValue,$operator);
!
!

$index_clause =
CassandraUtil::create_index_clause($indexArray);
!
!

$rows = $columnFamily>get_indexed_slices($index_clause);
|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

12
TTL in C*
$cf->insert('row_key', array('col1' => 'col_val1','col2'
=>'col_val2'),null,TTL);

$columnsTTL = array('col1'=>3, 'col2'=>4);
!

$cf->insert('row_key', array('col1' => 'val1','col2'
=>'val2'),null, $columnsTTL);

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

13
From MySQL to C*

Go Live!
Provisioning C* with Puppet
•12 servers with Ubuntu 10.04

!

package { 'cassandra':

 ensure => installed
}

initial_token: <%= ((2**127) * (current_cdb_server.to_i-1) /
cdb_servers_number.to_i ) %>

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

15
Provisioning C* with Puppet
Managing the data model
package { 'cassandra-data-model':

ensure => latest
}

migration_1.txt
migration_2.txt
migration_3.txt
migration_4.txt

Current Migration Id
2

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

16
Testing our cluster
Mysql performance

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

17
Testing our cluster
Cassandra performance

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

18
Testing our cluster
Resilience

|

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

19
Migration plan
t=0

t+15d

Read

Write

|

Read

Write

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

20
From MySQL to C*

Final words
THANK
YOU

For watching

Merci!
Thanks !

Thank you for
trusting me on
Cassandra (and
everything else)!

Thank you for the
support !

|

Thank you for the
opportunity to work
at La Poste !

www.xebia.fr | http://blog.xebia.fr | #CassandraEU
Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris

23

Más contenido relacionado

Más de DataStax Academy

Cassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart LabsCassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart Labs
DataStax Academy
 
Cassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stackCassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stack
DataStax Academy
 
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & PythonCassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
DataStax Academy
 
Standing Up Your First Cluster
Standing Up Your First ClusterStanding Up Your First Cluster
Standing Up Your First Cluster
DataStax Academy
 
Real Time Analytics with Dse
Real Time Analytics with DseReal Time Analytics with Dse
Real Time Analytics with Dse
DataStax Academy
 
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
 
Enabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax EnterpriseEnabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax Enterprise
DataStax Academy
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache Cassandra
DataStax Academy
 

Más de DataStax Academy (20)

Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Introduction to DataStax Enterprise Advanced Replication with Apache CassandraIntroduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
 
Cassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart LabsCassandra on Docker @ Walmart Labs
Cassandra on Docker @ Walmart Labs
 
Cassandra 3.0 Data Modeling
Cassandra 3.0 Data ModelingCassandra 3.0 Data Modeling
Cassandra 3.0 Data Modeling
 
Cassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stackCassandra Adoption on Cisco UCS & Open stack
Cassandra Adoption on Cisco UCS & Open stack
 
Coursera Cassandra Driver
Coursera Cassandra DriverCoursera Cassandra Driver
Coursera Cassandra Driver
 
Production Ready Cassandra
Production Ready CassandraProduction Ready Cassandra
Production Ready Cassandra
 
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & PythonCassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
 
Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 1Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 1
 
Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2
 
Standing Up Your First Cluster
Standing Up Your First ClusterStanding Up Your First Cluster
Standing Up Your First Cluster
 
Real Time Analytics with Dse
Real Time Analytics with DseReal Time Analytics with Dse
Real Time Analytics with Dse
 
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
 
Cassandra Core Concepts
Cassandra Core ConceptsCassandra Core Concepts
Cassandra Core Concepts
 
Enabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax EnterpriseEnabling Search in your Cassandra Application with DataStax Enterprise
Enabling Search in your Cassandra Application with DataStax Enterprise
 
Bad Habits Die Hard
Bad Habits Die Hard Bad Habits Die Hard
Bad Habits Die Hard
 
Advanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache CassandraAdvanced Data Modeling with Apache Cassandra
Advanced Data Modeling with Apache Cassandra
 
Advanced Cassandra
Advanced CassandraAdvanced Cassandra
Advanced Cassandra
 
Apache Cassandra and Drivers
Apache Cassandra and DriversApache Cassandra and Drivers
Apache Cassandra and Drivers
 
Getting Started with Graph Databases
Getting Started with Graph DatabasesGetting Started with Graph Databases
Getting Started with Graph Databases
 
Cassandra Data Maintenance with Spark
Cassandra Data Maintenance with SparkCassandra Data Maintenance with Spark
Cassandra Data Maintenance with Spark
 

Último

Último (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
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
 

C* Summit EU 2013: Delivering Christmas Gifts in France Since 2012

  • 2. Me, myself and I Puppet Software Cassandr a Matthie u Nantern @mNantern mnantern@xebia.fr | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 2
  • 3. From Mysql to Cassandra Overview 1 2 3 4 Context Why ? How ? Go Live! Delivering parcels at La Poste Why do we need another system ? Project’s constraints and alternatives How we build our solution. Using C* with PHP and managing TTL Provisioning servers. Performance and resilience testing | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 3
  • 4. La Poste Mail services Parcels distribution More than 250 000 employees 70 000 postmen delivering parcels | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 4
  • 5. La Poste Postman’s tour (1) A postman scans every parcels Print Scan (2) He prints his list of parcels (3) He distributes the parcels (4) He scans every remaining parcels Scan Distribute | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 5
  • 6. From MySQL to C* Why ?
  • 7. Why do we need another system ? | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 7
  • 8. Project’s constraints Max 13ms per call 15 days of retention for data Easy to deploy and operate Easy to scale for years to come | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 8
  • 9. From MySQL to C* How ?
  • 10. Data Modeling Id Data key1 key2 key3 Id Data Search1 Search2 1 <Xml> k11 k21 k31 1 <Xml> k11k31 k21k11 2 <Xml> k12 k22 k32 2 <Xml> k12k32 k22k12 3 <Xml> k13 k23 k33 3 <Xml> k13k33 k23k13 | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 10
  • 11. Using Cassandra with PHP For dummies $pool = new ConnectionPool("Keyspace1", array("cass:9160") $column_family = new ColumnFamily($pool, 'ColumnFamily1'); $column_family->insert('row_key', array('name1' => 'val1', 'name2' => 'val2')); $column_family->get('row_key'); $row1 = array('name1' => 'val1', 'name2' => 'val2'); $row2 = array('foo' => 'bar'); $column_family->batch_insert(array('row1' => $row1, 'row2' => $row2); | http://blog.xebia.fr | #CassandraEU www.xebia.fr | Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 11
  • 12. Using Cassandra with PHP Level 2 $index_exp=CassandraUtil::create_index_expression($inde xName, $indexValue,$operator); ! ! $index_clause = CassandraUtil::create_index_clause($indexArray); ! ! $rows = $columnFamily>get_indexed_slices($index_clause); | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 12
  • 13. TTL in C* $cf->insert('row_key', array('col1' => 'col_val1','col2' =>'col_val2'),null,TTL); $columnsTTL = array('col1'=>3, 'col2'=>4); ! $cf->insert('row_key', array('col1' => 'val1','col2' =>'val2'),null, $columnsTTL); | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 13
  • 14. From MySQL to C* Go Live!
  • 15. Provisioning C* with Puppet •12 servers with Ubuntu 10.04 ! package { 'cassandra': ensure => installed } initial_token: <%= ((2**127) * (current_cdb_server.to_i-1) / cdb_servers_number.to_i ) %> | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 15
  • 16. Provisioning C* with Puppet Managing the data model package { 'cassandra-data-model': ensure => latest } migration_1.txt migration_2.txt migration_3.txt migration_4.txt Current Migration Id 2 | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 16
  • 17. Testing our cluster Mysql performance | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 17
  • 18. Testing our cluster Cassandra performance | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 18
  • 19. Testing our cluster Resilience | www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 19
  • 20. Migration plan t=0 t+15d Read Write | Read Write www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 20
  • 21. From MySQL to C* Final words
  • 23. Thanks ! Thank you for trusting me on Cassandra (and everything else)! Thank you for the support ! | Thank you for the opportunity to work at La Poste ! www.xebia.fr | http://blog.xebia.fr | #CassandraEU Telephone : 33 (0)1 53 89 99 99 | email : info@xebia.fr | 156 bd Haussmann - 75008 Paris 23