Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Many Flavors of NoSQL at Midwest PHP

The Many Flavors of NoSQL at Midwest PHP

The relational database has been the dominant model for persisting data for the last 40 years. While SQL databases aren't going away anytime soon, the NoSQL ("not only SQL") movement has challenged the relational database's place as the default persistence layer for modern applications. Learn about horizontal scaling and eventual consistency as well as key-value stores, document databases, graph databases, and more.

Bradley Holt

March 05, 2016
Tweet

More Decks by Bradley Holt

Other Decks in Programming

Transcript

  1. Midwest PHP
    Bradley Holt, Developer Advocate
    Saturday, March 5, 2016
    The Many Flavors of NoSQL
    @BradleyHolt

    View Slide

  2. @BradleyHolt

    View Slide

  3. View Slide

  4. IBM Cloud Data Services
    Open for Data
    A comprehensive por.olio of open source data services

    View Slide

  5. View Slide

  6. View Slide

  7. Big Data
    Get it?

    View Slide

  8. A Brief History of Data

    View Slide

  9. The Relational Database
    @BradleyHolt
    order
    *order_id
    customer_id
    date
    customer
    line_item
    *customer_id
    email_address
    name
    *order_id
    *item_id
    price
    quantity

    View Slide

  10. ACID Guarantees
    Relational databases guarantee atomicity, consistency, isolation and durability

    View Slide

  11. Big Iron
    The ACID guarantees provided by relational databases were (and often still are) critical
    for systems of record

    View Slide

  12. The World Wide Web
    The introduction of the Web brought a whole new type of application with
    different constraints than systems of record
    @BradleyHolt

    View Slide

  13. Mobile Apps
    The introduction of mobile apps added to the growing number of systems of engagement

    View Slide

  14. Changing Constraints

    View Slide

  15. Always On

    View Slide

  16. Big Data

    View Slide

  17. The CAP Theorem
    @BradleyHolt
    Partition
    Tolerance
    Availability
    Consistency
    Consistency Availability
    Partition
    Tolerance

    View Slide

  18. Horizontal Scaling
    Horizontal scaling is scaling through the addition of commodity hardware

    View Slide

  19. Eventual Consistency
    Given no new updates, each node in a distributed system will eventually have a
    consistent view of the data

    View Slide

  20. Enter "Not only SQL" (NoSQL)

    View Slide

  21. @BradleyHolt
    key-value
    graph
    document
    …more

    View Slide

  22. @BradleyHolt

    View Slide

  23. Key-Value Stores
    Opaque data accessed through unique keys

    View Slide

  24. Document Databases
    A variation on key-value stores with strictly defined values (e.g. JSON objects)

    View Slide

  25. Graph Databases
    Nodes and properties of nodes connected via edges

    View Slide

  26. Choosing the Right Data Layer

    View Slide

  27. Data Store
    It is not possible to abstract all of the constraints of your data store

    View Slide

  28. Object-Relational Impedance Mismatch
    Object-oriented programming and relational databases use different models

    View Slide

  29. Semi-Structured Data
    Relational databases enforce a schema

    View Slide

  30. High Concurrency
    Database tuning often includes reducing the transaction scope or denormalization

    View Slide

  31. Eric Evans on NoSQL
    "This is the world of NoSQL to me, that we can choose a tool that fits well with
    the problem we're trying to solve." –Eric Evans (author of Domain-Driven Design)
    @BradleyHolt

    View Slide

  32. Strategic Design

    View Slide

  33. @BradleyHolt

    View Slide

  34. Bounded Context
    Bounded contexts allow different domain models to be used within different contexts

    View Slide

  35. One Data Layer Per Bounded Context
    Each bounded context should have its own data layer, and should not directly access a
    data layer belonging to another bounded context

    View Slide

  36. Data Systems
    A data layer may be a database, or it can be a data system consisting of multiple databases

    View Slide

  37. Microservices as Bounded Context
    Represent each bounded context as a microservice or a cluster of microservices

    View Slide

  38. @BradleyHolt
    Catalog
    Document Database
    Key/Value Store
    Graph Database
    Full Text Search
    Shopping
    Cart
    Document Database
    Key/Value Store
    Orders
    Relational Database
    Big Data Analytics (e.g.
    Apache Spark)

    View Slide

  39. Examples
    developer.ibm.com/clouddataservices

    View Slide

  40. View Slide

  41. Simple Data Pipe
    @BradleyHolt

    View Slide

  42. View Slide

  43. View Slide

  44. Further Reading
    @BradleyHolt

    View Slide

  45. Image Credits
    §  Open for Data Dome (outside) by Bradley Holt
    §  Open for Data Dome (inside) by Bradley Holt
    §  Brent Spiner (Data from Star Trek: The Next Generation) with
    Zoltar from Big by Bradley Holt, on Twitter

    §  database 2 by Tim Morgan, on Flickr
    §  Hard Disk by Jeff Kubina, on Flickr
    §  IBM 360 Announcement center by Robert Nix, on Flickr

    §  Dialing Up Web History by Mike Licht, on Flickr

    §  Instagram and other Social Media Apps by Jason Howie, on Flickr

    §  Dynamo, un siècle de lumière et de mouvement dans l'art, 1913 – 2013
    - Galeries nationales du Grand Palais - Paris - 10 avril au 22 juillet 2013
    by Yann Caradec, on Flickr
    §  World travel and communications recorded on Twitter by Eric Fischer,
    on Flickr
    §  Server grill with blue light by David Precious, on Flickr

    §  Spider Web by Alden Chadwick, on Flickr
    §  database by Tim Morgan, on Flickr
    §  Keys for the Stanley Hotel by Mike Silva, on Flickr

    §  paper by malik, on Flickr
    @BradleyHolt

    View Slide

  46. Image Credits (cont'd)
    §  Edinburgh Road Network analysis by Steven Kay, on Flickr

    §  Lina Bo Bardi, SESC Pompéia by paulisson miura, on Flickr

    §  Financial District Classical Building Reflection Distortion, San Francisco,
    California, USA by Wonderlane, on Flickr
    §  Untitled by Allen Lai, on Flickr
    §  Traffic Trails by Mohan Noone, on Flickr
    §  Eric Evans by Oliver Gierke, on Flickr
    §  rectangles by Dean Hochman, on Flickr
    §  Hexagons by Henry Burrows, on Flickr
    §  Rooted by Anna Levinzon, on Flickr
    §  Rainforest Biome by BMiz, on Flickr
    §  A mockup of the golden Apple iPhone 5S by Zach Vega,
    on Wikimedia Commons

    §  Marvin beating Data at Rock, Paper, Scissors by Marvin P Android,
    on Twitter

    @BradleyHolt

    View Slide

  47. joind.in/talk/d5b9d
    Questions?
    @BradleyHolt

    View Slide