Low-Power Distributed NoSQL Database For Lot Middleware
Low-Power Distributed NoSQL Database For Lot Middleware
Abstract-The Internet will become to the Internet of Things devices able to sense physical objects and translate them into a
(loT). It provides connectivity for everyone and everything that stream of information data, as well as the loT devices able to
embeds some intelligence in Internet-connected objects to trigger actions, maXUTIlzes safety, security, comfort,
communicate, exchange information, take decisions, invoke convenience and energy-savings. These devices will reach
actions and provide amazing services. This will bring a new nearly 26 billion connected devices by 2020. It is important to
ubiquitous computing and communication era and change
develop artificial intelligence algorithms which could be
people's lives (drastically/entirely). Moreover, the most important
centralized or distributed for supporting. One of the key
component in loT is database that used for collecting and storing
platforms for loT is the credit-card size computer such as
a lot of data from ubiquitous sensing devices. Even though, cloud
Raspberry Pi. It is a popular platform because it offers a
based storage solutions are becoming increasingly popular in
complete Linux server in a tiny device with very low cost and
recent years, it is inconvenient for residential environments
because the sensing devices should be connected to the internet for
satisfactory performance.
simultaneously sending data to cloud computing. However, this In this paper, we will explain how to construct database
solution has a high cost implication and high power consumption. server for loT middleware that have data distribution and low
Therefore, the credit-card sized computer which is fully functional
power consumption by using credit-card size computer like
is a good alternative. It is small and inexpensive computer that
Raspberry Pi with satisfactory performances and affordable
provides a new opportunity for loT hardware. As a result, it is
price. It is a perfect platform for interfacing with many
possible to use Raspberry Pi as a database server. In this paper,
ubiquitous sensing devices of residential environment such as
we will explain how to construct a database server for loT
homes, offices, or farms.
middleware that has data distribution and low-power
consumption by using credit-card size computers which have
II. ISSUES AND GOALS
satisfactory performances and affordable price.
The internet is expected to become the Internet of Things that
Keywords-Credit-card Sized Computer, Distributed Database, integrate the virtual world of information and the real world of
Embedded System, Internet of Things, loT Middleware, MongoDB, devices. It is able to have an immediate access to information
NoSQL Database, Low-power, Raspberry Pi about the physical world and its objects. This means a lot of data
from ubiquitous sensing devices will be present in a big database
for analyzing and visualizing.
I. INTRODUCTION
Normally, the database component of IoT will implement on
Nowadays, the Internet will become to the Internet of Things high-end servers as a cloud-based storage that is high reliability,
(loT) that is able to have an immediate access to information redundant, and security [1,2]. Even though, cloud-based storage
about the physical world and its objects. It has been introduced solutions are becoming increasingly popular in the years ahead,
to integrate the virtual world of information and the real world it is inconvenient for residential environment because the
of devices. loT covers the infrastructure, which can be hardware, sensing devices should be connected to the internet for
software and services, to support the networking of physical simultaneously sending data to cloud computing. However, this
world objects [1,2]. The loT aims to provide a simple interaction concept is expensive and has high power consumption when
between the physical world and the virtual world, by integrating applied to homes, offices, or farms environments. So, the credit
a large numbers of real-world physical devices (or things) into card sized computer like Raspberry Pi which is fully functional
the Internet. Therefore, it provides connectivity for everyone and is a good alternative [3,4,5]. It is a small, inexpensive computer
everything that embeds some intelligence in Internet-connected that provides a new opportunity for loT hardware. On the other
objects to communicate, exchange information, take decisions, hand, it is possible to use Raspberry Pi as a database servers for
invoke actions and provide amazing services [2,3]. This will loT local-base storage.
bring a new ubiquitous computing and communication era and
The main goal of this research is to define and present
change people's lives (drastically/entirely).
advantages and disadvantages of using credit-card size computer
One of the most important components in loT is the as a database server for middleware and abilities of its usage in
database. It will work in role for collecting and storing a lot of the development of the next generation of loT. The purposed
data from ubiquitous sensing devices [1]. The presence of smart concept can provide a simple and flexible database by using
Internet all the time for passing data. This is costly and has high In data node, it should be connected with sensors, motors and
power consumption when applied to homes, offices, or farm other embedded systems by using GPIO pins. It will store these
environments because of limited power source and internet data into database on itself. Finally, it will provide these data to
connectivity. master node when it requests.
Raspberry Pi is a credit-card size computer that was
developed in the Laboratory of University of Cambridge and Master Node
released by Raspberry Pi Foundation in 2012. It is a low-power
with ARM processors, commodity Ethernet interconnects, and
low-power flash based local storage. Moreover, it has general
purpose input and general-purpose output (GPIO) connectors for
communication with sensors, motors and other embedded
systems. It offers good enough performances and affordable
price hardware [5,6,7].
MongoDB database is a cross-platform document-oriented
database. Classified as a NoSQL database, MongoDB eschews
the traditional table-based relational database structure in favor
of JSON-like documents with dynamic schemas (MongoDB
calls the format BSON), making the integration of data in certain
Nodeftt-
I
II \\
types of applications easier and faster. As of July 2015, I II
'I
\\
\\
� ::_n_s��_: �J \�
MongoDB was the fourth most popular type of database ____ __ , __ ___ ,
: sen io r :: SE¥lsor :
management system, and the most popular for document stores �:: :1:: =:::::�:: =:
[8,9]. : Sensor :: Sensor :
,_ - - - __ - _11- _ __ __ __ ,
With the power of these two main technologies, Raspberry Fig.! : System Structure and Design
Pi and MongoDB database, we can create the database server by
using credit-card sized computer and NoSQL database engine V. SYSTEM DESIGN
for loT middleware. This system can use Raspberry Pi or some Regarding the design, we are proposing for two solutions for
common alternatives such as Banana Pi, Orange Pi or low-power distributed NoSQL database on credit-card size
BeagleBone Black because it is also small, powerful, cheap, and computer that have flash-based local storage. There are non-data
programmable computer board. copy oriented and data copy oriented from data node to master
IV. SYSTEM STRUCTURE node. The client will connect to master node by using database
application program interface (Database API) for query
In this system, it is contains two main parts: master node command. The master node will wake data node up by active
and data nodes. They work together as a single system which signal before getting the data (shown in Fig.2).
the master node is able to connect to one or more data nodes for
data distribution but data node is able to connect to only one
master node.
Conceptually, we will be running NoSQL database by using
MongoDB in individual data node for collecting data from their
own sensor data which is in wake up and sleep mode. The
master node will wake an individual data node up from sleep
mode and get data from them. In every data node, normally, Active Signal & Data Request
node. Master node always stays awake to wait for accesses from
Fig.2: System Design Conceptual
clients or users. By using wake up and sleep mode as active and
inactive concepts, it can reduce power consumption of each A. Non-data Copy Oriented Design
node following by Fig.l. In the first step, the client will send the query request to
A. Master Node master node by using Database API. Second, the master node
will look at metadata table of sensor nodes stored within it and
In master node, it will play in roles of communicator with
fmd the node with data that matches with query request. Third,
clients and commander with data nodes for controlling. This
the master node will send an active signal to selected data nodes 2) CPU Clock Speed and Frequency
that matched the metadata table. Fourth, the data node will send As the Raspberry Pi does not have a conventional BIOS, the
the sensor data to master node. Finally, the master node will various system configuration parameters that would normally
combine all of sensor data from selected data nodes then be kept and set using the BIOS are now stored in a text file
respond to the client. named "config.txt". Therefore, it can experience overclocking.
J) Advantages Regarding the overclocking, it has some important
• The data node will use their own storage for configuration options for low power.
collecting and storing sensor data in individuals. 1) arm_freq: frequency of ARM in MHz. 2) sdram_freq:
• It can use its own local storage efficiently. frequency of SDRAM in MHz. 3) arm_fre�min: minimum
• It is distributed data. value of arm_freq used for dynamic clocking. 4)
2) Disadvantages core_fre�min: minimum value of core_freq used for dynamic
• It is slow because it will send all the data that
clocking. 5) sdram_fre�min: minimum value of sdram_freq
matched for every request from master node. used for dynamic clocking. 6) over_voltage_min: minimum
value of over_voltage used for dynamic clocking.
B. Data Copy Oriented Design With the overclocking configuration, it can control power
Both the data copy oriented and non-data copy oriented of Raspberry Pi. When the work load is high, it will use
have the same designs although there are a few differences. maximum power. On the other hand, when it is standby or free
Normally, the data nodes do periodic transmission of updated mode, it will use minimum power for power saving.
sensor data to store in master node. In fourth step, when the
master node collect data from data node, the data node will sent VI. EvALUATlON AND DISCUSSIONS
updated sensor data to master node only. In this evaluation, we will compare between x86 machine
J) Advantages and Raspberry Pi for operation time and power consumption to
• It is faster than non-data copy oriented design.
support our proposed. The evaluation environments for x86,
2) Disadvantages Intel Core i7 870 @ 2.93GHz, 3.9 GB of memory, 128 GB of
disk storage, and Ubuntu 14.04 LTS. For Raspberry Pi 2 Model
• The master node should have a very large volume of
B, ARM Cortex-A7 @ 900 MHz, 1 GB of memory, 16 GB of
local storage.
SD card and Raspbian Jessie 4.1. In addition, MongoDB 2.6.12
These two solutions: non-data copy oriented and data copy and MySQL 5.5.49 for x86 machine and MongoDB 2.4.10 and
oriented. They offer different advantages and disadvantage s MySQL 5.5.44 for Raspberry Pi.
depending on need. If usage storage efficiently is important, the
non-data copy oriented solution is better. On the other hand, if A. MySQL and MongoDB Comparison
speed is the priority, the data copy oriented solution is good This comparison shown the MySQL and MongoDB
enough. performance for data inserting and data selecting on Raspberry
Pi as shown in Table I. In the table, "I" is represents inserting
C. Query Divide Algorithm
data into database, "SA" is represents searching of all records,
In master node, when it is receiving a query request from "SW" is represents searching with where conditions, "UA" is
the client, it will forward that query to selected data nodes. represents updating of all records, "UW" is represents update
Before this, master node will select data node for getting data with where conditions, "DA" is represents delete all records, and
by looking at sensor node metadata on itself frrst. In sensor node "DW" is represents deleting with where conditions.
metadata, it is a table in master node that contains information
of data node as metadata: data node id, sensor key and last TABLE I. MYSQL AND MONGoDB COMPARISON
active. The master node will use these metadata for selecting Database I SA SW UA UW DA DW
data nodes. Then, it will be sent an active signal to selected data
MySQLI
nodes and get data these node by using same query request from 76.64 6.72 0.85 8.93 1.98 0.03 0.50
x86
client. MySQLI 31.6
765.54 4.98 2.14 6.15 3.03 2.00
Rasp. Pi 2
D. Power Control Algorithm
MongoDBI
1,084.24 8.87 0.28 3.70 0.29 6.40 0.28
In credit-card size computer board, mostly, it does not have x86
a power management component on itself. Therefore, we will MongoDBI 45.8 126.
1,086.61 7.42 4.27 4.48 4.31
suggest an ideas and algorithms to power control and operations Rasp. Pi 8 20
. �I
>
iii
t"
� 100 �
.,. 00
ii
'" vi N
N
,,� �
00
N�'"
cY"!1..C!V"!
�ooo
,,"':N
"! 50
0 -
�i�
'" 00
-
���
-- .
000
o .: : . OO�
::1 000
SA SW UA UW DA DW
SA SW UA UW DA DW
• 1,000,000 • 2,000,000 • 5,000,000
• 1,000,000 • 2.000,000 • 5,000,000
·�
.,.
150
" searching on one million, two million and five million records
� '" respectively. In contrast, Raspberry Pi consumes 30 joules, 60
'"
I
'0
8 100 o-i
OON joules and 143 joule for searching on one million, two million
T
.,.
� en
and five million records respectively. In brief, Raspberry Pi
ii ii
....
" 50 00 N '"
"
O"\�Lfl ooC!m reduces power consumption for 45% compare to x86 machine.
;::
0 -
� i Cj
.,. <D
- -
l"'!�r--;
.,.
-
<D
-
000
q
.,.
-
�rf1
-
<D
-
'g 250 [5] Anwaar,Waqas,and Munam Ali Shah. "Energy Efficient Computing: A
� Comparison of Raspberry PI with Modern Devices." Energy 4.02,2015.
�200 '"
....
� ...;
en
'" [6] Snyder, Robin M. "Power monitoring using the Raspberry Pi."
! 150 ::: ..
Association Supporting Computer Users in Education "Our Second
> �
il il
t" Quarter Century of Resource Sharing" pp. 82,2014.
� 100
.,.
.,.
en
'"
'"
0 [7] Maksimovi6,Mirjana,et a!. "Raspberry Pi as Internet of things hardware:
50 "'o-i performnces and constraints." Design Issues 3, pp. 8,2014.
","IN ;::�� mL11�
o .:: : . :: . 000
:: . [8] Strauch, Christof, Ultra-Large Scale Sites, and Walter Kriha. "NoSQL
SA SW UA UW DA DW databases." Lecture Notes,Stuttgart Media University, 20II.
• 1,000,000 • 2,000,000 • 5,000,000 [9] Parker, Zachary, Scott Poe, and Susan V. Vrbsky. "Comparing NoSQL
MongoDB to an SQL DB." Proceedings of the 51st ACM Southeast
Conference. ACM,2013.
Fig.5: Power Consumption Measurement of MongoDB on x86 Machine