1/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Evaluating Databases for the Internet of Things David Gogrichiani - - PowerPoint PPT Presentation
Evaluating Databases for the Internet of Things David Gogrichiani - - PowerPoint PPT Presentation
Evaluating Databases for the Internet of Things David Gogrichiani Advisor(s): Stefan Liebald, Marc-Oliver Pahl Supervisor: Prof. Dr.-Ing. Georg Carle Technical University of Munich (TUM) Department of Informatics Chair of Network Architectures
2/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Overview
Introduction/Problem Statement
- Virtual State Layer
Key Findings of Analysis/Related Work Design/Implementation
- MongoDB
- OrientDB
- Benchmark
Evaluation Conclusion/Future Work
- Artifacts
3/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Introduction
Virtual State Layer
- Is a part of DS2OS
- Is a middleware
- Manages access control, communication and persistence
- Consists of Knowledge Agents
Knowledge Agents
- Store virtual representations of IoT devices (Context Nodes)
- Manage these representations
○ Communicate with each other ○ Provide information for DS2OS services Database backend
- Each Knowledge Agents has its own persistent storage
- Currently relational database HSQLDB is used
4/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Structure of VSL Context Tree
Context Tree
- Represents real world object
- Information represented in a tree-like structure
- Parts of an object are viewed as sub-trees
Lamp1 Lightbulb1 Lightbulb2 SwitchButton1
5/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Questions to answer:
- What is a suitable database architecture for DS2OS?
○ How to represent tree-structure context nodes within the database? ○ How to keep versioning/archive of context nodes?
- How to evaluate performance of chosen databases in regard to VSL?
Research questions
6/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Key findings of Analysis/Related Work
Chosen databases, based on related studies [1,2,3,4,5,6]:
- MongoDB as document-oriented database
- OrientDB as multi-model/graph based solution
Database type Flexibility Complex queries Native tree handling Consistency Speed Examples Relational + +++
- ++
++ HyperSQL, PostgreSQL Key-value +
- +++
Redis, Riak KV Document-oriented ++ ++
- ++
MongoDB Graph-based + + ++ + + Neo4j Multi-model ++ ++ + + + OrientDB, ArangoDB
7/21 David Gogrichiani | Evaluating Databases for the Internet of Things
MongoDB
{ "_id" : ObjectId("5a4fd4262263da1815efad17"), "address" : "/agent1/system/config/korSync", "ancestors" : [ "/agent1/system/config", "/agent1/system", "/agent1", "/" ], "types" : [ "/basic/number" ], "readerIDs" : [ "system/config", "system" ], "writerIDs" : [ "system/config", "system" ], "version" : NumberLong(0), "value" : "60000", "timestamp" : ISODate("2018-01-05T19:38:15.065Z") }
- Data stored as
documents
- Documents stored
in collections
8/21 David Gogrichiani | Evaluating Databases for the Internet of Things
OrientDB
- Data stored in records
- Records can be either documents, BLOB, Vertex/Edge depending on operating mode
- Records are divided into clusters
{ "rid" : 6, "address" : "/agent1/system/config/korSync", "types" : [ "/basic/number" ], "readerIDs" : [ "system/config", "system" ], "writerIDs" : [ "system/config", "system" ], "version" : NumberLong(0), "value" : "60000", "timestamp" : ISODate("2018-01-05T19:38:15.065Z") } rid:0 rid:1 rid:2 rid:4 rid:5 rid:7 rid:3 rid:6
9/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Design
How to represent tree-structure context nodes within the database?
- Nested document
- Materialized path
- References to direct Parent or Children
- Array of Ancestors
10/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Design
How to represent tree-structure context nodes within the database?
- Nested document
- Materialized path
- References to direct Parent or Children
- Array of Ancestors
MongoDB
- All ancestors as separate field in a document
OrientDB
- Handled natively by the database
11/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Design
How to handle versioning/archive of context nodes?
- New document with incremented version for each new state
- New document with “current” field
- Previous states embedded in a document
- Previous states in separate collection
12/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Design
How to handle versioning/archive of context nodes?
- New document with incremented version for each new state
- New document with “current” field
- Previous states embedded in a document
- Previous states in separate collection
MongoDB
- Previous states of a node in separate collection
OrientDB
- Previous states of a node as a map object inside of document
13/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Testing approach:
- Simulate interaction between a service and Knowledge Agent
○ Close to real-world scenario ○ Takes into account differences in database implementation for VSL
Evaluation
DS2OS Service VSL Knowledge Agent Database
14/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Performance evaluation:
- Create a context tree, for testing purposes
- Issue 110, 1100, 11000 either get/set operations
Evaluation
n1 n10 n1 n10 n1 n10 n1 n10 n2 rn
Root Node of the service
15/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Evaluation
Expected results:
- Implemented databases perform on the same level with existing solution
- MongoDB is expected to perform better in write-intensive environment
- OrientDB is expected to handle graph structures efficiently
16/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Evaluation
17/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Evaluation
18/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Evaluation
Results:
- MongoDB performs slightly better than current solution
○ Difference more pronounced during read-intensive operations
- OrientDB performs significantly worse than other solutions
○ Does not match expectations ○ Need to be examined further
19/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Conclusion/Future Work
Conclusion:
- MongoDB performs slightly better than current solution
- OrientDB performs significantly worse than other solutions
Artifacts:
- Implemented interface for MongoDB
- Implemented interface for OrientDB
- Simple benchmark DS2OS service
Future work:
- Implement other types of databases for VSL
- Expand database benchmark
- Investigate OrientDB further
20/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Questions?
21/21 David Gogrichiani | Evaluating Databases for the Internet of Things
Sources
[1]: J. S. van der Veen, B. van der Waaij and R. J. Meijer, "Sensor Data Storage Performance: SQL or NoSQL, Physical or Virtual," 2012 IEEE Fifth International Conference
- n Cloud Computing, Honolulu, HI, 2012, pp. 431-438.