ciel, mes données ne sont plus relationnelles
Embed Size (px)
DESCRIPTION
Quand la gestion des données de nos applications web dépasse la simple persistance dans une base de données relationnelle (type SGBD), l’utilisation de technologies alternatives dites « NoSql » est nécessaire. Nous aborderons les 4 grandes familles de NoSql (Key/Value, Document, Column-oriented et Graph) ainsi que leur intégration dans des applications PHP.TRANSCRIPT
- 1. Ciel ! Mes donnes ne sontplus relationnellesBLEND WEB MIX01 Octobre 20131
2. Xavier [email protected] 3. 3Association Franaise des Utilisateurs de PHP Cre en 2001 Forum PHP ( 21 & 22 Novembre 2013 Paris) AperoPHP et Rendez Vous Antennes Locale Prsident en 2009 www.afup.orgAssociation Francophone des utilisateurs de SYmfony Initi en 2010 par Hugo Hamon Pas encore une vraie association Sfpot mensuel avec confrence suivie dun apro Antenne Marseille, Lyon ??www.afsy.fr 4. 4Elao Fondateur en 2005 Lyon & Paris Agence Web Technique de 15 personnes Symfony depuis 2006 Partenaire officiel SensioLabswww.elao.com 5. 5 6. Plan Trend Key-value databases Document databases Graph databases Column-oriented databases6 7. RDBMS performance7Data complexityPerformanceRelational databaseRequirement of applicationSalary&list&Most&Web&apps&Social&Network&Loca5on7based&services&Source @ianSrobinson - @jimwebber from NeoTechnology 8. complexity = f(size, connectedness, uniformity)8 9. Data Size92007 2008 2009 2010 201120122013 10. Data Size 500 million page views a day ~3TB of new data to store a day Posts are about 50GB a day.Follower list updates are about2.7TB a day.10 11. Connectedness11Wikis)Blogs)Tagging)Ontologies)RDFa)web 1.0 web 2.0 web 3.01990 2000 2010 2020Source @ianSrobinson - @jimwebber from NeoTechnologyInforma(on)connec(vity) Text)Documents)Hypertext)Feeds)UGC)Folksonomies)GGG) 12. Uniformity Semi-structureddata Differentdatalifecycle Storemoredataabouteachen7ty Individualisa7on&decentraliza7onofcontentgenera7on12 13. NoSQLNot Only SQL13 14. NoSQL Non-Rela7onal ClusterFriendly Schemaless Distributedarchitecture14 15. ACID & CAP TheoremACID Atomicity Consistency Isola7on Durability15CapTheorem Consistency Availability Par77onTolerance 16. Column 1 : valueColumn 2 : valueColumn 3 : valueKeyKeyKey/Value Column-orientedField 1 : valueField A : valueField B : valueField 2 : valueNode 1Node 3Node 2Node 4Node 5DocumentorientedGraphKey ValueKey ValueKey ValueKey Value16 17. Column 1 : valueColumn 2 : valueColumn 3 : valueKeyKeyKey/Value Column-orientedField 1 : valueField A : valueField B : valueField 2 : valueNode 1Node 3Node 2Node 4Node 5DocumentorientedGraphKey ValueKey ValueKey ValueKey Value17 18. Key-value databases Inspired by Amazons Dynamo (2007) Global collection of key-value Big scalable HashMap18 19. Strengths Simple data model High performance Great at scaling out horizontally Weaknesses Simplistic data model Poor for complex data19Key-value databases 20. Written in C - BSD License - 2009 Very fast and light-weigth All data in memory Persistence Master/Slave Replication Used for caching, session or workingqueue20Key-value databaseshttp://redis.io/ 21. Riak Memcache (RAM) Voldemort Amazon DynamoDB (Saas) IronCache (Saas)21Key-value databases 22. Column 1 : valueColumn 2 : valueColumn 3 : valueKeyKeyKey/Value Column-orientedField 1 : valueField A : valueField B : valueField 2 : valueNode 1Node 3Node 2Node 4Node 5DocumentorientedGraphKey ValueKey ValueKey ValueKey Value22 23. Document databases Inspired by IBM Lotus Notes/Domino Idem from Key/Value with value as adocument A document is a key-value collection Flexible schema Non-relational, data is de-normalized23 24. Document databases Strengths Simple, powerful data model Good scaling, Easy/Auto sharding Usually ACID compliant Weaknesses Unsuited for interconnected data Query model limited to keys (and indexes)24 25. Document databases Written in C++ - License AGPL - 2009 JSON-style documents Full Index Support Fast In-Place Updates Auto-Sharding Replication & High Availability A lot of Connector Big Community Commercial Support25http://www.mongodb.org 26. Document databases Lotus Notes / Domino CouchDBwritten in Erlang, Javascript for Query OrientDBwritten in Java, relationship as graph26 27. Column 1 : valueColumn 2 : valueColumn 3 : valueKeyKeyKey/Value Column-orientedField 1 : valueField A : valueField B : valueField 2 : valueNode 1Node 3Node 2Node 4Node 5DocumentorientedGraphKey ValueKey ValueKey ValueKey Value27 28. Graph databases Nodes with properties Named relationships with properties Focus on the data structure Direct pointer to its adjacent element andno indexlookups are necessary28 29. Graph databases Strengths Powerful data model Fast for connected data A new data architecture Weaknesses No Sharding : All data in one instance Using Node/Relation property for Query killperformance A new data architecture29 30. Graph databases Java - GPL/Commercial - 2007 Query language : Cypher / Gremlin REST Interface Embed Mode High Availability ( Master / Slave) Commercial Supporthttp://neo4j.org30 31. GraphDB - Products Titan OrientDB InfiniteGraph AllegroGraph31 32. Column 1 : valueColumn 2 : valueColumn 3 : valueKeyKeyKey/Value Column-orientedField 1 : valueField A : valueField B : valueField 2 : valueNode 1Node 3Node 2Node 4Node 5DocumentorientedGraphKey ValueKey ValueKey ValueKey Value32 33. Column-oriented database A big table, with column families Data stored by column instead of row Build for distributed architecture Map-reduce for querying/processing Flexible schema Easy sharding (partitioning)33 34. Column-oriented database Strengths Data model supports semi-structured data Naturally indexed (columns) Horizontally scalable RW increase linearly Fault tolerant no single point of failure Weaknesses Unsuited for interconnected data34 35. Column-oriented database Java - Apache License 2 - 2008 Developed by Facebook Decentralized Supports replication and multi data centerreplication Scalability Fault-tolerant MapReduce supporthttp://cassandra.apache.org/35 36. Column-oriented database HBase (Apache) HyperTable BigTable (Google)36 37. Conclusion Application architecture impact Store your data in the way you want toquery it Denormalize your data and try to keepthem up-to-date !37 38. 38 39. Merci