No-Nonsense NoSQL

by Jenn Strater @jennstrater

Current

http://jlstrater.github.io/No-Nonsense-NoSQL

Slides(source)

Previous Versions

GreachSource |Slides

About Me

Professional

About Me

Minneapolis, MN

Pet Mom & Foster Mom

Pumpkin Halo Juliet

What I am Not!

  • An expert on every aspect of every NoSQL solution
  • The best at word choice when I get nervous/excited(please stop me if I don't make sense!)

Agenda

  • Review of Relational Databases
  • Gr8Ladies Example Application
  • NoSQL Definition
  • Types of NoSQL data stores
  • Example
    • MongoDB
    • Redis

Relational Databases

  • Tabular
  • Defined Schema
  • Relationships between data
  • Terms
    • Database
    • Table
    • Row
    • Column

Review

Groovy

  • Dynamic, compiled language for the Java Virtual Machine(JVM).
  • Interoperable with existing Java libraries
  • Concise, easy to read code
  • Used by many major companies including:

Grails

  • Groovy Based
  • Model View Controller(MVC) Web framework for the JVM
  • Convention over Configuration
  • Features including:
    • Object Relational Mapper(ORM)
    • Domain-Specific Languages(DSL)
    • Runtime and compile-time Metaprogramming
  • Extensive Plugin Support
  • Open-source community driven Project

New in Grails 3

  • Based on Spring Boot
  • Switched to Gradle for build system
  • Major structural changes
    • Configuration
    • Scripts

Example Task

Gr8Ladies Products

  • Catalog Products
  • Shopping Cart

What is NoSQL?

  • Not Only SQL
  • Group of data storage solutions that are not Relational Database Management System(RDBMS)
    • Schema-less
    • Non-relational

Types of NoSQL solutions

  • Key-value
  • Document
  • Column
  • Graph

Key-value Stores

Examples

  • MemCached
  • DynamoDB
  • Redis*

Uses

  • Content Caching
  • Transient Data
    • Session Data
  • Image Stores

Considerations

  • Relationships
  • Transactions
  • Querying

Libraries & Plugins

Document Stores

Examples

  • CouchDB
  • RavenDB
  • Azure DocumentDB
  • MongoDB

Uses

  • Content Management Systems(CMS) / Blogging Platforms
  • Forms/data with many optional fields
  • Frequently Changing Schemas

Considerations

  • Complex transactions
  • Complex searching

Libraries & Plugins

Column Databases

Examples

  • Cassandra
  • HBase
  • Hypertable

Use Cases

  • CMS Systems/ Blogging Platforms
  • Log Aggregators
  • Incremental Counters

Considerations

  • Schema Changes
  • Arbitrary unstructured data

Graph Databases

Examples

  • Neo4J
  • OrientDB
  • Allegro Graph

Uses

  • Many connections between data
    • Social Networks
    • E-commerce Recommendations
  • Nearby Locations and Routing

Considerations

  • Cascading writes
  • Very different way of thinking about data

Libraries & Plugins

Suggested Reading

  • Sadalage, Pramod J., and Martin Fowler. NoSQL Distilled: A Brief Guide to the Emerging World of Polyglot Persistence. Addison-Wesley Professional, 2012. Print.
  • Vardanyan, Mikayel. "Picking the Right NoSQL Database Tool." Monitis Blog. 22 May 2011. Web.
  • Copeland, Rick. MongoDB Applied Design Patterns. O'Reilly Media, 2013. Print.
  • Chinnachamy, Arun. Redis Applied Design Patterns. Packt Publishing, 2014. Print.

How do I pick just one?

You don't have to!

Approach # 1

All In - MongoDB GORM

MongoDB

Terminology

  • Databases
  • Collections
  • Document

MongoDB Continued

    Highlights
  • Created When Needed
    • Databases
    • Collections
  • Optional Fields
  • BSON Object Ids over Integers

Approach # 2

Partial - Grails-Redis plugin

Redis

Terminology

  • Keys
  • Types
    • String
    • Hash
    • Sets

Highlights

  • Organized/Indexed Keys
  • CRUD operations
  • Key Expiration
  • Service Level Injection rather than all of GORM

Conclusion

  • Picking a NoSQL solution depends on the problem
  • Not every tool is the right one for the job
  • NoSQL stores are valid alternatives to relational databases
  • NoSQL solutions are highly supported in Groovy and Grails