No SQL
No SQL
Introduction
• It’s born out of a need to handle larger data
volumes which forced a fundamental shift to
building large hardware platforms through
clusters of commodity servers.
• Advocates of NoSQL databases claim that they
can build systems that are more performant,
scale much better, and are easier to program
with.
Why Are NoSQL Databases Interesting?
• Application development productivity. A lot
of application development effort is spent on
mapping data between in-memory data
structures and a relational database.
• A NoSQL database may provide a data model
that better fits the application’s needs, thus
simplifying that interaction and resulting in
less code to write, debug, and evolve.
Cont’d
• Large-scale data. Organizations are finding it valuable
to capture more data and process it more quickly.
• They are finding it expensive, if even possible, to do so
with relational databases.
• The primary reason is that a relational database is
designed to run on a single machine, but it is usually
more economic to run large data and computing loads
on clusters of many smaller and cheaper machines.
• Many NoSQL databases are designed explicitly to run
on clusters, so they make a better fit for big data
scenarios.
The Value of Relational Databases
• Getting at Persistent Data – provide a “backing” store
for volatile memory
– Two areas of memory:
• Fast, small, volatile main memory
• Larger, slower, non volatile backing store
• Since main memory is volatile to keep data around, we
write it to a backing store, commonly seen a disk which
can be persistent memory.
The backing store can be: • File system • Database
The database allows more flexibility than a file system in
storing large amounts of data in a way that allows an
application program to get information quickly and easily.
Concurrency
• Multiple applications accessing shared data
– Transactions
• Enterprise applications tend to have many people using
same data at once, possibly modifying that data.
• We have to worry about coordinating interactions
between them to avoid things like double booking of
hotel rooms
• Since enterprise applications can have lots of users and
other systems all working concurrently, there’s a lot of
room for bad things to happen.
• Relational databases help to handle this by controlling
all access to their data through transactions..
Integration
• Enterprise requires multiple applications, written by
different teams, to collaborate in order to get things done.
• Applications often need to use the same data and updates
made through one application have to be visible to others.
• A common way to do this is shared database integration
where multiple applications store their data in a single
database.
• Using a single database allows all the applications to use
each others’ data easily, while the database’s concurrency
control handles multiple applications in the same way as it
handles multiple users in a single application.
Impedance Mismatch
• Impedance mismatch is a term used in computer science to
describe the problem that arises when two systems or
components that are supposed to work together have
different data models, structures, or interfaces that make
communication difficult or inefficient.
• In the context of databases, impedance mismatch refers to the
discrepancy between the object-oriented programming (OOP)
model used in application code and the relational model used
in database management systems (DBMS).
• While OOP models are designed to represent data as objects
with properties and methods, relational models represent data
as tables with columns and rows.
• This impedance mismatch can create challenges when it comes
to mapping objects in code to tables in a database or vice
versa.
Impedance Mismatch
• The difference between the relational model
and the in-memory data structures.
• The relational data model organizes data into
a structure of tables.
– Where a tuple is a set of name-value pairs and a
relation is a set of tuples.
• Structure and relationships have to be
mapped
– Rich, in-memory structures have to be translated
to relational representation to be stored on disk
– Translation: impedance mismatch
Cont’d
Cont’d
• Impedance mismatch has been made much
easier to deal with by the wide availability of
object relational mapping frameworks.
• Impedance mismatch has been made much
easier to deal with by the wide availability of
object relational mapping frameworks, such as
Hibernate and iBATIS that implement well-
known mapping patterns but the mapping
problem is still an issue.
Application and Integration Databases
• Data integration is the process of taking data from
different sources and formats and combining it into a
single data set.
• Integration database - with multiple applications, usually
developed by separate teams, storing their data in a
common database.
• This improves communication because all the applications
are operating on a consistent set of persistent data.
Or
• An integration database is a database which acts as the
data store for multiple applications, and thus integrates
data across these applications .
Cont’d
Cont’d
Integrate many applications becomes (dramatically)
more complexthan any single application needs
−Changes to the data model must be
coordinated
−Different structural and performance needs for
different applications
−Database integrity becomes an issue
Instead, treat the database as an application
database
−Single application, single development team
−Provide alternate integration mechanisms
Cont’d
• Data integration platforms are an efficient
approach to data utilization and storage.
• Different kinds of data are best dealt with different data stores. In
short, it means picking the right tool for the right use case.
Example
• Looking at a Polyglot Persistence example, an e-
commerce platform will deal with many types
of data (i.e. shopping cart, inventory, completed
orders, etc). Instead of trying to store all this
data in one database, which would require a lot
of data conversion to make the format of the
data all the same, store the data in the
database best suited for that type of data. So
the e-commerce platform might look like this:
Cont’d
Cont’d
Cont’d