C* - Delivering Christmas gifts in France since 2012
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

C* - Delivering Christmas gifts in France since 2012

  • 522 views
Uploaded on

Slides from my presentation at Cassandra Summit Europe 2013. ...

Slides from my presentation at Cassandra Summit Europe 2013.

Every year more and more people buy their Christmas gifts online and that gifts are delivered by the postal service of France "La Poste".
At the end of the infrastructure a (not so) little MySQL was struggling for survival against that overwhelming load.

Then, in 2011, MySQL hit its limit... Come hear the true story of La Poste switching its parcel management, PHP-based application, from MySQL to Cassandra in 3 weeks.
You'll be taught about the details of the project constraints, how to use Cassandra from PHP, the migration plan, how to manage resilience testing, deploy your Cassandra with Puppet, and all the wonderful knowledge we accumulate through this project.

More in: Technology , Travel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
522
On Slideshare
520
From Embeds
2
Number of Embeds
1

Actions

Shares
Downloads
7
Comments
0
Likes
1

Embeds 2

https://twitter.com 2

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Cassandra Delivering Christmas gifts in France since 2012
  • 2. Me, myself and I Puppet Software @mNantern Cassandra Matthieu Nantern 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 Distribute Scan | 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 ? 1
  • 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 ? 2
  • 10. Data Modeling Data key1 key2 key3 Id 1 <Xml> k11 k21 k31 2 <Xml> k12 k22 3 <Xml> k13 k23 Id | Data Search1 Search2 1 <Xml> k11k31 k21k11 k32 2 <Xml> k12k32 k22k12 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); | 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 11
  • 12. Using Cassandra with PHP Level 2 $index_exp=CassandraUtil::create_index_expression($indexName, $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! 3
  • 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 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 Write 20
  • 21. From MySQL to C* Final words 4
  • 22. THANK YOU For watching Merci!
  • 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