Hybrid systems that integrate MapReduce and RDBMS aim to combine the best of both worlds. In-database MapReduce systems like Greenplum and HadoopDB run MapReduce programs directly on relational data for high performance and to leverage existing RDBMS features like SQL, security, backup/recovery and analytics tools. File-only systems like Pig and Hive are easier for developers but provide less integration with RDBMS functionality. Overall the relationship between MapReduce and RDBMS continues to evolve as each aims to address the other's limitations.
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
MapReduce Debates and Schema-Free
1. http://www.coordguru.com
MapReduce Debates and Schema-Free
- Big Data, MapReduce, RDBMS+MapReduce, Non-Relational DB
Woohyun Kim
The creator of open source “Coord”
(http://www.coordguru.com)
2010-03-03
3. http://www.coordguru.com
Noah’s Ark Problem
• Did Noah take dinosaurs on the Ark?
• The Ark was a very large ship designed especially for its important purpose
• It was so large and complex that it took Noah 120 years to build
• How to put such a big thing
• Diet or DNA?
• Differentiate, Put, and Integrate
• Larger?
• More?
• ‚Big Data‛ problem is just like that
• Compression or Reduction
• gzip, Fingerprint, DNA, MD5, …
• Scale Up
• Scale Out
4. http://www.coordguru.com
Perspectives of Big Data
•SAN •SQL
•HDFS •MapReduce
•Hbase, Voldemort, MongoDB, •Pig
Cassandra •Hive, CloudBase
•HadoopDB
Store Process
Analyze Retrieve
•OLAP •SQL
•Text/Data Mining •MapReduce
•Social/Semantic Analysis •Key-Value
•Visualization •RESTFul
•Reporting
6. http://www.coordguru.com
Case Study: User Credit Analysis
A User Credit Model
User Credit
0.5 ∑
0.5
amount
quality
∑ 0.3 ∑
0.1 0.7
0.3 0.6
Open100_write Answer_ Question_cn confidence popularity
_cnt cnt t
∑ ∑
-0.5 0.5 -0.2 0.8
Confidence_negative Confidence_positive Popularity_negative popularity_positive
∑ ∑ ∑
0.5 0.5 0.5 0.5 1.0 0.7 0.3
Confidence_positive_ Confidence_negativ best_answer_ Total_kinup_poi
Penalty_cnt Admin_delete content e_user Report_cnt
_cnt cnt nt
∑
1.0 0.3 0.3
0.4
Aha_best_cnt Is_honor Dredt_level Is_sponsor
ETL
7. http://www.coordguru.com
Case Study: User Credit Analysis
Preprocessing Blog Data for Analyzing User Credit
Post * Attachment
pt_log1.csv
make_blog_
post_info.cpp
pt_attachfile1.csv Post/Attachment *
Buddy/Count/PowerBlogger/Commen
Blog Post t
att_pt_log.cpp
Buddy
pt_buddy.csv cal_buddy_
cnt.cpp
Buddy * Count
pt_count.csv att_visit_
count.cpp Buddy/Count * PowerBlogger
pt_power_blog1.csv att_is_power
blogger.cpp Buddy/Count/PowerBlogger * Comment
pt_comment1.csv att_commenting.cpp
Blogger
8. http://www.coordguru.com
New Changes surrounding Data Storages
• Volume
• Data volumes have grown from tens of gigabytes in the 1990s to hundreds of
terabytes and often petabytes in recent years
• Scale Out
• Relational databases are hard to scale
• Partitioning(for scalability)
‚Relations‛ get broken
• Replication(for availability)
• Speed
• The seek times of physical storage is not keeping pace with improvements in network
speeds
‚New Relations‛
• Integration
• Today’s data processing tasks increasingly have to access and combine data from
many different non-relational sources, often over a network
10. http://www.coordguru.com
Best Practice in Hadoop
• Software Stack in Google/Hadoop • Cookbook for ‚Big Data‛
• Structured Data Storage for ‚Big Data‛
Row key Column key
Row
Structured
Data
Time
Column Column stamp
Family Family
14. http://www.coordguru.com
Case Study: Further Study in Parallel Join
Problems
• Need to sort
• Move the partitioned data across the network
• Due to shuffling, must send the whole data
• Skewed by popular keys
• All records for a particular key are sent to the same reducer
• Overhead by tagging
Alternatives
• Map-side Join
• Mapper-only job to avoid sort and to reduce data movement across the
network
• Semi-Join
• Shrink data size through semi-join(by preprocessing)
15. http://www.coordguru.com
Case Study: Improvements in Parallel Join
Map-Side Join
• Replicate a relatively smaller input source to the cluster
• Put the replicated dataset into a local hash table
• Join – a relatively larger input source with each local hash table
• Mapper: do Mapper-side Join
Semi-Join
• Extract – unique IDs referenced in a larger input source(A)
• Mapper: extract Movie IDs from Ratings records
• Reducer: accumulate all unique Movie IDs
• Filter – the other larger input source(B) with the referenced unique IDs
• Mapper: filter the referenced Movie IDs from full Movie dataset
• Join - a larger input source(A) with the filtered datasets
• Mapper: do Mapper-side Join
• Ratings records & the filtered movie IDs dataset
17. http://www.coordguru.com
MapReduce is just A Major Step Backwards!!!
Dewitt and StoneBraker in January 17, 2008
• A giant step backward in the programming paradigm for
large-scale data intensive applications
• Schema are good
• Type check in runtime, so no garbage
• Separation of the schema from the application is good
• Schema is stored in catalogs, so can be queried(in SQL)
• High-level access languages are good
• Present what you want rather than an algorithm for how to get it
• No schema??!
• At least one data field by specifying the key as input
• For Bigtable/Hbase, different tuples within the same table can
actually have different schemas
• Even there is no support for logical schema changes such as
views
18. http://www.coordguru.com
MapReduce is just A Major Step Backwards!!! (cont’d)
Dewitt and StoneBraker in January 17, 2008
• A sub-optimal implementation, in that it uses brute force instead of
indexing
• Indexing
• All modern DBMSs use hash or B-tree indexes to accelerate access to data
• In addition, there is a query optimizer to decide whether to use an index or
perform a brute-force sequential search
• However, MapReduce has no indexes, so processes only in brute force fashion
• Automatic parallel execution
• In the 1980s, DBMS research community explored it such as Gamma, Bubba,
Grace, even commercial Teradata
• Skew
• The distribution of records with the same key causes is skewed in the map
phase, so it causes some reduce to take much longer than others
• Intermediate data pulling
• In the reduce phase, two or more reduce attempt to read input files form the
same map node simultaneously
19. http://www.coordguru.com
MapReduce is just A Major Step Backwards!!! (cont’d)
Dewitt and StoneBraker in January 17, 2008
• Not novel at all – it represents a specific implementation of well
known techniques developed nearly 25 years ago
• Partitioning for join
• Application of Hash to Data Base Machine and its Architecture, 1983
• Joins in parallel on a shared-nothing
• Multiprocessor Hash-based Join Algorithms, 1985
• The Case for Shared-Nothing, 1986
• Aggregates in parallel
• The Gamma Database Machine Project, 1990
• Parallel Database System: The Future of High Performance Database Systems,
1992
• Adaptive Parallel Aggregation Algorithms, 1995
• Teradata has been selling a commercial DBMS utilizing all of these
techniques for more than 20 years
• PostgreSQL supported user-defined functions and user-defined
aggregates in the mid 1980s
20. http://www.coordguru.com
MapReduce is just A Major Step Backwards!!! (cont’d)
Dewitt and StoneBraker in January 17, 2008
• Missing most of the features that are routinely included in current DBMS
• MapReduce provides only a sliver of the functionality found in modern DBMSs
• Bulk loader – transform input data in files into a desired format and load it into a DBMS
• Indexing – hash or B-Tree indexes
• Updates – change the data in the data base
• Transactions – support parallel update and recovery from failures during update
• integrity constraints – help keep garbage out of the data base
• referential integrity – again, help keep garbage out of the data base
• Views – so the schema can change without having to rewrite the application program
• Incompatible with all of the tools DBMS users have come to depend on
• MapReduce cannot use the tools available in a modern SQL DBMS, and has none of
its own
• Report writers(Crystal reports)
• Prepare reports for human visualization
• business intelligence tools(Business Objects or Cognos)
• Enable ad-hoc querying of large data warehouses
• data mining tools(Oracle Data Mining or IBM DB2 Intelligent Miner)
• Allow a user to discover structure in large data sets
• replication tools(Golden Gate)
• Allow a user to replicate data from on DBMS to another
• database design tools(Embarcadero)
• Assist the user in constructing a data base
22. http://www.coordguru.com
RDB experts Jump the MR Shark
Greg Jorgensen in January 17, 2008
• Arg1: MapReduce is a step backwards in database access
• MapReduce is not a database, a data storage, or management system
• MapReduce is an algorithmic technique for the distributed processing of large
amounts of data
• Arg2: MapReduce is a poor implementation
• MapReduce is one way to generate indexes from a large volume of data, but it’s not
a data storage and retrieval system
• Arg3: MapReduce is not novel
• Hashing, parallel processing, data partitioning, and user-defined functions are all old
hat in the RDBMS world, but so what?
• The big innovation MapReduce enables is distributing data processing across a
network of cheap and possibly unreliable computers
• Arg4: MapReduce is missing features
• Arg5: MapReduce is incompatible with the DBMS tools
• The ability to process a huge volume of data quickly such as web crawling and log
analysis is more important than guaranteeing 100% data integrity and completeness
23. http://www.coordguru.com
DBs are hammers; MR is a screwdriver
Mark C. Chu-Carroll
• RDBs don’t parallelize very well
• How many RDBs do you know that can efficiently split a
task among 1,000 cheap computers?
• RDBs don’t handle non-tabular data well
• RDBs are notorious for doing a poor job on recursive data
structures
• MapReduce isn’t intended to replace relational
databases
• It’s intended to provide a lightweight way of programming
things so that they can run fast by running in parallel on a
lot of machines
24. http://www.coordguru.com
MR is a Step Backwards, but some Steps Forward
Eugene Shekita
• Arg1: Data Models, Schemas, and Query Languages
• Semi-structured data model and high level of parallel data flow query language is
built on top of MapReduce
• Pig, Hive, Jaql, Cascading, Cloudbase
• Hadoop will eventually have a real data model, schema, catalogs, and query
language
• Moreover, Pig, Jaql, and Cascading are some steps forward
• Support semi-structured data
• Support more high level-like parallel data flow languages than declarative query
languages
• Greenplum and Aster Data support MapReduce, but look more limited than Pig, Jaql,
Cascading
• The calls to MapReduce functions wrapped in SQL queries will make it difficult
to work with semi-structured data and program multi-step dataflows
• Arg3: Novelty
• Teradata was doing parallel group-by 20 years ago
• UDAs and UDFs appeared in PostgreSQL in the mid 80s
• And yet, MapReduce is much more flexible, and fault-tolerant
• Support semi-structured data types, customizable partitioning
33. http://www.coordguru.com
Challenges in Traditional RDBMS
• Volume
• Data volumes have grown from tens of gigabytes in the 1990s to hundreds of
terabytes and often petabytes in recent years
• Speed
• The seek times of physical storage is not keeping pace with improvements in network
speeds
‚New Relations‛
34. http://www.coordguru.com
Challenges in Traditional RDBMS (cont’d)
• Scale Out
• Is it possible to achieve a large number of simple read/write operations per second?
• Traditional RDBMSs have not provided good horizontal scaling for OLTP
• Partitioning(for scalability)
‚Relations‛ get broken
• Replication(for availability)
• Data warehousing RDBMSs provide horizontal scaling of complex joins and queries
• Most of them are read-only or read-mostly
• Integration
• Today’s data processing tasks increasingly have to access and combine data from
many different non-relational sources, often over a network
35. http://www.coordguru.com
The New Faces of Data
• Scale out
• CAP Theorem
• CAP theorem simply states that any distributed data system can only achieve two of these
three at any given time
• Hence when building distributed systems, Just Pick 2/3
• Design Issues
• ACID
• BASE
Atomicity
Consistency
Isolation
Durability Basically
Available
Soft-state
Eventual Consistency
v0
36. http://www.coordguru.com
The New Faces of Data (cont’d)
• Sparsity
• Some data have sparse attributes
• document-term vector
Schema-Free
• user-item matrix
• semantic or social relations
• Some data do not need ‘relational’ property, or complex join queries
• log-structured data
• stacking or streamed data
• e.g. Facebook, Server Density(MySQL -> MongoDB)
• Immutable
• Do not need update and delete data, only insert it with versions
• tracking history
• lock-free
• atomicity is based on just a key
40. http://www.coordguru.com
Key Features of Non-Relational Databases
• Common Features
• A call level interface (in contrast to a SQL binding)
• HTTP/REST or easy to program APIs
• Fast indexes on large amounts of data
• Lookups by one and more keys(key-value or document)
• Ability to horizontally scale throughput over many servers
• Automatic sharding or client-side manual sharding
• Built-in replication(sync or async)
• Eventual Consistency
• Ability to dynamically define attributes or data schema
• Key-Value, Column, or Document
• Support for MapReduce
41. http://www.coordguru.com
Data Models of Non-Relational Databases
• Data Models
• Tuple
• A set of attribute-value pairs
• Attribute names are defined in a schema
• Values must be scalar(like numbers and strings), not BLOBs
• The values are referenced by attribute name, not by ordinal position
• Document
• A set of attribute-value pairs
• Attribute names are dynamically defined for each document at runtime
• Unlike Tuple, there is no global schema for attributes
• Values may be complex values or nested values
• Multiple indexes are supported
• Extensible Record
• A hybrid between Tuple and Document
• Families of attributes are defined in a schema
• New attributes can be defined (within an attribute family) on a per-record basis
• Object
• A set of attribute-value pairs
• Values may be complex values or pointers to other objects
42. http://www.coordguru.com
Classes of Non-Relational Databases
• Classification by Data Model
• Key-value Stores
• Store values and an index to find them
• Provide replication, versioning, locking, transactions, sorting, and etc.
• Document Stores
• Store indexed documents(with multiple indexes)
• Not support locking, synchronous replication, and ACID transactions
• Instead of ACID, support BASE for much higher performance and scalability
• Provide some simple query mechanisms
• Extensible Record Stores(=Column-oriented Stores)
• Store extensible records that can be horizontally and vertically partitioned across nodes
• Both rows and columns are splitted over multiple nodes
• Rows are split across nodes by range partitioning
• Columns of a table are distributed over multiple nodes by using ‚column groups‛
• Relational Databases
• Store, index, and query tuples
• Some new RDBMSs provide horizontal scaling
43. http://www.coordguru.com
A Comparison of Non-Relational Databases
Langu Replicatio Consistency & Data mode Doc
Project Partitioning Persistence Client Protocol Community
age n Transaction l s
Lock + limited ACID tr
Bigtable C++ Sync(GFS) Range Memtable/SSTable on GFS
ansactions
Custom API Column A Google, no
Lock + limited ACID tr
Hbase Java Sync(HDFS) Range Memtable/SSTable on HDFS
ansactions
Custom API, Thrift, Rest Column A Apache, yes
Lock + limited ACID tr
Hypertable C++ Sync(FS) Range CellCache/CellStore on any FS
ansactions
Thrift, other Column A Zvents, Baidu, yes
MVCC + limited ACID t Column & Key
Cassandra Java Async Hash On-disk
ransactions
Thrift
-Value
B Facebook, no
Key-Value or
Sync(on clie Hash (on client Custom API(python, php,jav
Coord C++
nt-side) -side)
Pluggable: in-memory, Lucene no
a, c++)
Document(jso A NHN, yes
n)
Dynamo ? Yes Yes ? Custom API Key-Value A Amazon, no
Key-Value(bl
Voldemort Java Async Hash Pluggable: BerkleyDB, Mysql MVCC Java API
ob/text)
A Linkedin, no
Hash (on client In-memory with background sna
Redis C Sync
-side) pshots
lock Custom API(Collection) Key-Value C some
In-memory or on-disk(hash , b-t
Manual shardin lock + limited
Tokyo Tyrant C Async
g
ree, fixed-size/variable-length r
ACID transactions
Key-Value C
ecord tables)
lock + limited ACID tr Key-Value(bl
Scalaris Erlang Sync Range Only in-memory
ansactions
Erlang, Java, HTTP
ob)
B OnScale, no
Key-Value(bl
Kai Erlang ? Yes On-disk Dets file Memcached
ob)
C no
Key-Value(bl
Dynomite Erlang Yes Yes Pluggable: couch, dets Custom ascii, Thrift
ob)
D+ Powerset, no
Key-Value(bl
MemcacheDB C Yes No BerkleyDB Memcached
ob)
B some
Pluggable: in-memory, ets, dets,
Key-Value &
Riak Erlang Async Hash osmos tables (no indices on 2nd MVCC Rest(json-based)
Document
B no
key fields)
No automated s
SimpleDB ? Async
harding
S3 no Custom API Document B Amazon, no
Pluggable: BerkleyDB, Custom,
ThruDB C++ Yes No
Mysql, S3
Thrift Document C+ Third rail, unsure
No automated s On-disk with append-only B-tre HTTP, json, Custom API(ma Document(jso
CouchDB Erlang Async
harding e
MVCC
p/reduce views) n)
A Apache, yes
HTTP, bson, Custom API(Cur Document(bs
MongoDB C++ Async Sharding new On-disk with B-tree Filed-level
sor) on)
A 10gen, yes
Neo4J On-disk linked lists Custom API(Graph) Graph
On-going classification by Woohyun Kim
44. http://www.coordguru.com
Document-oriented vs. RDBMS
CouchDB MongoDB MySQL
Terminology Document, Field, Database Document, Key, Collection
Data Model Document-Oriented (JSON) Document-Oriented (BSON) Relational
string, int, double, boolean, date, bytea
Data Types Text, numeric, boolean, and list Link
rray, object, array, others
Large Objects (Files) Yes (attachments) Yes (GridFS) no???
Master-master (with developer sup
Replication Master-slave Master-slave
plied conflict resolution)
Object(row) Storage One large repository Collection based Table based
Map/reduce of javascript functions Dynamic; object-based query language
Query Method Dynamic; SQL
to lazily build an index per query
Secondary Indexes Yes Yes Yes
Atomicity Single document Single document Yes – advanced
Interface REST Native drivers Native drivers
Server-side batch dat Yes, via javascript(thru. map/reduce
Yes, via javascript Yes (SQL)
a manipulation views)
Written in Erlang C++ C
Concurrency Control MVCC Update in Place Update in Place
46. http://www.coordguru.com
Appendix: What is Coord?
Architectural Comparison
• dust: a distributed file system based on DHT
• coord spaces: a resource sharable store system based on SBA
• coord mapreduce: a simplified large-scale data processing framework
• warp: a scalable remote/parallel execution system
• graph: a large-scale distributed graph search system
47. http://www.coordguru.com
Appendix: Coord Internals
A space-based architecture built on distributed hash tables
SBA(Space-based Architecture)
processes communicate with others thru. only spaces
DHT(Distributed Hash Tables)
data identified by hash functions are placed on numerically near nodes
A computing platform to project a single address space on
distributed memories
As if users worked in a single computing environment
App
take write
read
2m-1 0
node 1 node 2 node 3 node n