Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

ToursJUG mongoDB

1 430 vues

Publié le

Talk donné au ToursJUG le 11/06/2014 à propos de MongoDB et contenant un retour d'expérience de l'utilisation chez SRMvision pour construire un système de statistiques

Publié dans : Logiciels
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici

ToursJUG mongoDB

  1. 1. Cedric Gatay - c.gatay@code-troopers.com MongoDB What’s up doc ?
  2. 2. Cedric Gatay - c.gatay@code-troopers.com Cedric Gatay • Code-Troopers • Packt • github.com/CedricGatay • @Cedric_Gatay 2
  3. 3. Cedric Gatay - c.gatay@code-troopers.com NoSQL 3 Clef /Valeur Colonne Graphe Document
  4. 4. Cedric Gatay - c.gatay@code-troopers.com Clef /Valeur • Énormes volumes • Stockage basique • Pas de types de données • Opérations simples 4
  5. 5. Cedric Gatay - c.gatay@code-troopers.com Colonne • Stockage inverse du relationnel • Index pour retrouver une donnée • Opérations simples 5
  6. 6. Cedric Gatay - c.gatay@code-troopers.com Graphe • Stocke les noeuds et arcs • Requêtes évoluées • Opérations simples 6
  7. 7. Cedric Gatay - c.gatay@code-troopers.com Document • Ensemble de champs nommés • typage optionnel • Requêtes évoluées • Opérations plus complètes 7
  8. 8. Cedric Gatay - c.gatay@code-troopers.com MongoDB 8
  9. 9. Cedric Gatay - c.gatay@code-troopers.com MongoDB 9
  10. 10. Cedric Gatay - c.gatay@code-troopers.com Caractéristiques • Pas de schéma • Pas de transactions "longues" • Pas de jointures 10
  11. 11. Cedric Gatay - c.gatay@code-troopers.com Caractéristiques • Stockage en BSON • JSON • Typage • Compressé 11
  12. 12. Cedric Gatay - c.gatay@code-troopers.com Caractéristiques • Hautes performances • C++ • Grosse utilisation mémoire • Lectures / Écritures rapides 12
  13. 13. Cedric Gatay - c.gatay@code-troopers.com Caractéristiques • Scalable • failover automatique • distribution des lectures • distribution des données 13
  14. 14. Cedric Gatay - c.gatay@code-troopers.com Populaire 14
  15. 15. Cedric Gatay - c.gatay@code-troopers.com Document 15 > cg = {name : 'Cedric Gatay', age : 30} > db.troopers.save(cg) • Enregistrer une entrée
  16. 16. Cedric Gatay - c.gatay@code-troopers.com Requêtes 16 > db.troopers.find() { _id : ObjectId("ef43a2c954236e2d65a81c5e"), name : 'Cedric Gatay', age : 30 }
  17. 17. Cedric Gatay - c.gatay@code-troopers.com Requêtes 17 > db.troopers.find({name: 'Darth Vader'}) { _id : ObjectId("133713371337133713371337"), name : 'Darth Vader', age : 42 }
  18. 18. Cedric Gatay - c.gatay@code-troopers.com Opérateurs 18 # $all, $exists, $mod, $ne, $in, $nin, $nor, # $or, $size, $type, $lt, $lte, $gt, $gte > db.troopers.find({age: {$gte : 30}}).count() 1 • Opérateurs
  19. 19. Cedric Gatay - c.gatay@code-troopers.com Documents imbriqués 19 { _id : ObjectId("ef43a2c954236e2d65a81c5e"), name : 'Cedric Gatay', age : 30, projects : [{ name : 'Aucard de Tours', stack : 'Android', status : 'Done' },{ name : 'Nowly', stack : 'Android' }] }
  20. 20. Cedric Gatay - c.gatay@code-troopers.com Map / Reduce • Répartition de calcul • Permet la fusion de données • Fonctions JavaScript 20
  21. 21. Cedric Gatay - c.gatay@code-troopers.com Utilisation depuis Java • Morphia • mapping pseudo JPA • POJO pour collections • API pour les queries 21
  22. 22. Cedric Gatay - c.gatay@code-troopers.com Morphia POJO 22 @Entity("employees") class Employee { @Id ObjectId id; String firstName, lastName; }
  23. 23. Cedric Gatay - c.gatay@code-troopers.com Morphia Query 23 Datastore ds = new Morphia(/*...*/); ! ds.save(new Employee("John", "Doe")); ! Employee john = ds.find(Employee.class) .field("firstName") .equal("John") .get();
  24. 24. Cedric Gatay - c.gatay@code-troopers.com Morphia : résumé • JPA est adapté au relationnel • Le modèle document est assez éloigné • Certains concepts ne sont pas traduits 24
  25. 25. Cedric Gatay - c.gatay@code-troopers.com Utilisation depuis Java • Jongo • Jackson pour le marshalling • Driver Java attaqué directement 25
  26. 26. Cedric Gatay - c.gatay@code-troopers.com Jongo POJO 26 class Employee { ObjectId id; String firstName, lastName; }
  27. 27. Cedric Gatay - c.gatay@code-troopers.com Jongo Query 27 MongoCollection employees = jongo.getCollection("employees"); ! employees.insert("{firstName:’John’, lastName:’Doe’}")); ! Employee john = employees .findOne("{firstName:’John’}") .as(Employee.class);
  28. 28. Cedric Gatay - c.gatay@code-troopers.com Jongo : résumé • Attention aux refactors • Utilise directement le Driver Java • Le plus rapide ! 28
  29. 29. Cedric Gatay - c.gatay@code-troopers.com MongoDB Retour d’expérience
  30. 30. Cedric Gatay - c.gatay@code-troopers.com SRMvision 30 • 10/2008 • 2 développeurs ! • 01/2014 • 7 développeurs
  31. 31. Cedric Gatay - c.gatay@code-troopers.com31 Gestion d’incidents
  32. 32. Cedric Gatay - c.gatay@code-troopers.com32 Gestion de projets
  33. 33. Cedric Gatay - c.gatay@code-troopers.com33 Gestion de parc
  34. 34. Cedric Gatay - c.gatay@code-troopers.com Technos 34
  35. 35. Cedric Gatay - c.gatay@code-troopers.com35 Retour aux sources
  36. 36. Cedric Gatay - c.gatay@code-troopers.com Besoin initial • Restitution statistiques décideurs • Analyse de la qualité de prestations • Résolution incidents • Complétude parc 36
  37. 37. Cedric Gatay - c.gatay@code-troopers.com Stats v1 • État de l'art • Business intelligence • Intégration Mondrian 37
  38. 38. Cedric Gatay - c.gatay@code-troopers.com Architecture • Mondrian rempli par un cron • Activité SQL lourde • Construction cube CPU bound • Schéma OLAP dans un XML • Requêtes SQL en base • Requêtes MDX en base 38
  39. 39. Cedric Gatay - c.gatay@code-troopers.com Avantages • Fonctionne bien • Mise en place rapide • OLAP est connu 39
  40. 40. Cedric Gatay - c.gatay@code-troopers.com Inconvénients ! • Complexe à comprendre et à maintenir • Apprentissage du MDX • Mises à jour difficiles • Synchronisation SQL > OLAP 40
  41. 41. Cedric Gatay - c.gatay@code-troopers.com41 Pendant ce temps…
  42. 42. Cedric Gatay - c.gatay@code-troopers.com Analyse utilisation plateforme • Google Analytics like • Collecte info browser / user • Prétexte d'essai NoSQL 42
  43. 43. Cedric Gatay - c.gatay@code-troopers.com État de l'art NoSQL ! • Etudes différents paradigmes • MongoDB • approche document évolutive • communauté active • le plus proche de notre besoin 43
  44. 44. Cedric Gatay - c.gatay@code-troopers.com Réalisation • Collecte en JS vers un web service • Back-office de consultation ! ! • En 2 mois de stage... 44
  45. 45. Cedric Gatay - c.gatay@code-troopers.com En temps réel 45
  46. 46. Cedric Gatay - c.gatay@code-troopers.com46 Statistiques
  47. 47. Cedric Gatay - c.gatay@code-troopers.com Évolution des stats • Construire d’autres stats • Permettre au client de construire ses stats • Alléger le système 47
  48. 48. Cedric Gatay - c.gatay@code-troopers.com Une stat • Un ensemble d'axes • Documents adaptés • Des mesures • Fonctions mathématiques d’agrégation 48
  49. 49. Cedric Gatay - c.gatay@code-troopers.com Architecture • Morphia pour un mapping pseudo JPA • QueryDSL pour des queries typesafe 49
  50. 50. Cedric Gatay - c.gatay@code-troopers.com Problèmes • Passage SQL vers NoSQL • Possibilité de resynchronisation • Not Only NoSQL 50
  51. 51. Cedric Gatay - c.gatay@code-troopers.com Fonctionnement • Écriture des documents • Transformation d’entités vers documents • Trigger JPA pour lancer la copie 51
  52. 52. Cedric Gatay - c.gatay@code-troopers.com Youpi les données sont dans MongoDB Il ne reste "qu’à" les transformer 52
  53. 53. Cedric Gatay - c.gatay@code-troopers.com53 Sous le capot Comment ça se passe pour les développeurs ?
  54. 54. Cedric Gatay - c.gatay@code-troopers.com Décrire les documents • Un POJO par document • Annotations • pour les axes • pour les mesures 54
  55. 55. Cedric Gatay - c.gatay@code-troopers.com Faire les calculs • Écrire les fonctions de calcul • Associer une annotation par fonction 55
  56. 56. Cedric Gatay - c.gatay@code-troopers.com Stocker les stats The easy part… 56
  57. 57. Cedric Gatay - c.gatay@code-troopers.com Résumé • Transformation des entités en documents • Manipulation avec le Map/Reduce 57
  58. 58. Cedric Gatay - c.gatay@code-troopers.com IHM • Complètement générique • Basée sur les annotations • Traductions à ajouter 58
  59. 59. Cedric Gatay - c.gatay@code-troopers.com59 Dynamique
  60. 60. Cedric Gatay - c.gatay@code-troopers.com60 Tableaux de bord
  61. 61. Cedric Gatay - c.gatay@code-troopers.com Stats v2 90 jh 61
  62. 62. Cedric Gatay - c.gatay@code-troopers.com62 Difficultés
  63. 63. Cedric Gatay - c.gatay@code-troopers.com MongoDB • Appréhender le modèle document • Comprendre le map/reduce • Idempotence • JavaScript • Debug 63
  64. 64. Cedric Gatay - c.gatay@code-troopers.com Faiblesses du système • JavaScript dans le Java • tests importants (> 80% couverture) • IntelliJ IDEA @Language 64
  65. 65. Cedric Gatay - c.gatay@code-troopers.com Faiblesses du système • Another point of failure? • dépendance non critique • mongodump/mongorestore 65
  66. 66. Cedric Gatay - c.gatay@code-troopers.com Faiblesses du système • Pré-requis supplémentaire • Procédure de déploiement • Tests d’intégration 66
  67. 67. Cedric Gatay - c.gatay@code-troopers.com Bilan • Système compréhensible • Liberté laissée aux clients ! • On a mis en prod MongoDB ! 67
  68. 68. Cedric Gatay - c.gatay@code-troopers.com68 Astuces
  69. 69. Cedric Gatay - c.gatay@code-troopers.com Astuces • GUI • MongoHub (Mac) • RoboMongo 69
  70. 70. Cedric Gatay - c.gatay@code-troopers.com Astuces • Montée en version • lire le changelog • tester dans une sandbox 70
  71. 71. Cedric Gatay - c.gatay@code-troopers.com Astuces • Debug Map/Reduce • substitution emit • print • tojson 71
  72. 72. Cedric Gatay - c.gatay@code-troopers.com Merci 72
  73. 73. Cedric Gatay - c.gatay@code-troopers.com Credits • https://www.flickr.com/photos/mongodb/7416213536/sizes/o/ • https://www.flickr.com/photos/jenny-pics/6110974997/sizes/o/ • https://www.flickr.com/photos/artbystevejohnson/8479160301/sizes/o/ • https://www.flickr.com/photos/wbaiv/6268300461/sizes/o/ • https://www.flickr.com/photos/st3f4n/4360212268/sizes/o/ • https://www.flickr.com/photos/afagen/8297146248/sizes/o • https://www.flickr.com/photos/anubisabyss/9639217548/sizes/o • https://www.flickr.com/photos/garrettheath/9371876094/sizes/o • Trademarks belong to their respective owners 73

×