Spring + QueryDSL + MongoDB Presentation

Post on 17-Jul-2015

579 views 2 download

Transcript of Spring + QueryDSL + MongoDB Presentation

Spring + MongoDB + Querydsl

June 18th 2014

By Ranga Vadlamudi1/20/2015

About Speaker

Experience in Enterprise/Application Architecture

Extensive Startup experience

Big Data experience in Cloudera Stack, MongoDB, Cassandra

ranga@webexl.com

@webexl

webexl.blogspot.com

Experience in

• Based on the use case solutions need to be catered to make sure data resides in the right place, Nosql versus File system for example

• Approach will be crucial in delivering real time solutions and handle volumes of data

Data Storage Solutions

• Real time versus Offline data retrieval is crucial for any project success. Was a great learning experience in arriving at solutions to achieve velocity

• In memory solutions and Indexing help in achieving faster retrieval

Data Retrieval Solutions

• Analyze large sets of different variety of data to find patterns which help in business intelligence

• Data Visualization is great feature to view data graphically

Data Analytics & Visualization

About the Session

• Brief Introduction to Spring & Spring Data

• Introduction to Querydsl

• Introduction to MongoDB

• Spring + QueryDSL + MongoDB

Spring Framework

• An open source application framework

• A light weight solution for enterprise applications

• POJO Based

• One of the most popular Java enterprise frameworks

• Makes it easy to use data access technologies

• Reduces amount of boiler plate code

• Umbrella project with subprojects specific to a given database

• Community support from developers of specific databases

Spring Data

Spring Data Core Concepts

• Repositories reduces boiler plate code required to implement

data access layer across persistent stores

• Central Interface of Spring Data is Repository

• CrudRepository provides CRUD functionality

Spring Data Core Concepts

• Proxy instances are created for the interfaces at runtime

• Pagination Access to entities is provided by

PagingAndSortingRepository

Spring Data Core Concepts

Spring Data Configuration

• Using Java Config

• Using XML Config

Spring Data Keywords

Spring Data Build Dependency

Querydsl

• Querying tool for Java

• Type safe query language

• Syntactically close to SQL

• Great for dynamic query building

• Consistent API across databases

Querydsl

• Basic Query Example

• Sub Query Example

Querydsl

• Order Example

Flow

Code for Entity Class

Add Querydsl Dependency

Add Querydsl Plugin to generate

Classes from Entities

Import Generated classes into

Code

Build Dynamic

Query in Java

Specify Database and

issues queries

Querydsl Build Dependency

Querydsl Build Dependency

What is Big Data

• Volume: Large Amounts of Data at rest

• Velocity: milliseconds to seconds to respond

• Variety: Data in many forms (Structured, Unstructured,

Multimedia, Text etc.)

• Veracity: Data in doubt

Volumes of Data We are Seeing Currently

• 30 billion pieces of content a month

• 1 Peta byte of content every day

• 2 Billion videos watched everyday

• 3 Billion people will be online

• Sharing 8 zettabytes of data

Big Data Solutions

Big Data

Real Time

Batch

Mining & Analytics

Machine Learning

Storage

Big Data Solution Landscape

Technology Landscape

CAP Theorem/Selection Trade-off

MongoDB

• Schema Free, schemas change as applications evolve

• Full Index support for high availability

• Auto sharding for horizontal scaling

• Replication and Failover for high availability

Where to Use MongoDB

• RDBMS replacement for Web scale applications

• For Operational intelligence (Logging etc. temporal data)

• Product Data management including Catalogs

• Content Management systems like blog posts including

media

Where not to Use MongoDB

• Highly transactional applications

• Applications with traditional database requirements like

foreign key constraints etc.

Where MongoDB Stands

MongoDB Data Models

• Stores JSON documents

• Known as BSON (Binary JSON)

• References

• Embedded

MongoDB Operations

RDBMS MONGODB

Create Insert Insert

Read Select Find

Update Update Update

Delete Delete Remove

Demo

MongoDB Replication

MongoDB Automatic Failover

MongoDB Sharding

Questions?

Thank You