<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>E
M
F
RO</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>IoT Data Storage: Relational &amp; Non-Relational Database Management Systems Performance Comparison</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Gizem Kiraz</string-name>
          <email>501631002@ogr.uludag.edu.tr</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Cengiz Toğay</string-name>
          <email>ctogay@ uludag.edu.tr</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Computer Engineering, Uludag University</institution>
          ,
          <addr-line>Gorukle, Bursa</addr-line>
        </aff>
      </contrib-group>
      <volume>5</volume>
      <issue>00</issue>
      <abstract>
        <p>Internet of Things (IoT) becomes recently a popular research topic and market reality. According to several research companies, in 2025, up to 75 billion devices are estimated to connect internet and generate an enormous number of data. This increases in data cause several difficulties such as the storage cost and processing of such large data. In this paper, we have been studied on performance comparison of relational (MySQL) and nonrelational (MongoDB) database management systems for storing and processing of this large IoT data. Both types of database management systems have been tested. According to comparison of experimental results, the nonrelational database management systems, which we studied and searched, have provided better performance for storing and processing of large data.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Internet of Things</kwd>
        <kwd>MySQL</kwd>
        <kwd>MongoDB</kwd>
        <kwd>RDBMS</kwd>
        <kwd>NRDBMS</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>INTRODUCTION</title>
      <p>
        The Internet of Things (IoT) is a self-configuring and
adaptive system that consist of sensor networks and smart
objects whose aim is to interconnect all devices/sensors in
daily life [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. According to the projections of many
organizations and companies, up to 75 billion devices will
interconnect using the internet and several challenges and
issues that need to be addressed will raise. Therefore, IoT
becomes one of the most popular research topic recent
years. Moreover, IoT is closely related to big data and
cloud technology. Big data is produced by the different
types of the applications such as industrial processes,
medical devices, embedded control systems, gateways,
and GPS sensors etc. This means that an amount of data
worldwide increases day by day. In 2016, more than 5.5
million connected devices are inserted every day, and it is
expected that number of devices more than 20.8 billion
worldwide by 2020 [2]. Sensors are also produced data
and they are important for big data growth. The sensor
data is the most popular data type between IoT
applications.
      </p>
      <sec id="sec-1-1">
        <title>Big data is a term that describes the large volume of data</title>
        <p>–both structured and unstructured. The DBMSs basically
can be separated into relational and non-relational DBMS.</p>
      </sec>
      <sec id="sec-1-2">
        <title>The relational DBMS stores the data rows and columns in</title>
        <p>tables with a high data consistency. The most commonly
used open source relational DBMS is MySQL.
Nonrelational databases (NOSQL) have arisen as an
alternative to relational databases. The aim of the NOSQL
is often not to give guaranty the Atomicity, Consistency,</p>
      </sec>
      <sec id="sec-1-3">
        <title>Isolation, and Durability (ACID). The NOSQL does not</title>
        <p>depend on constant table definitions and rigid schemas.</p>
      </sec>
      <sec id="sec-1-4">
        <title>Columns or records can be added to the collection at any</title>
        <p>time without exclusive process. Therefore; the number of
records in the columns does not have to equal with each
other. Data sets in IoT environment can change after setup
of the system, so this environment requires a flexible data
storage system. There are four different storage formats in</p>
      </sec>
      <sec id="sec-1-5">
        <title>NOSQL namely key-value, columns, document-based and graff-based.</title>
      </sec>
      <sec id="sec-1-6">
        <title>It has been investigated a document-based storage format</title>
        <p>in NOSQL. In such a system, a record is called document
and these documents are usually stored in JSON format
[3]. There are various implementation of the NOSQL
DBMS such as MongoDB [4] [5], CouchDB [6], HBase
[7], Cassandra [8], Amazon SimpleDB [9], and Redis
[10]. Since MongoDB is open source and commonly used,
it has been chosen MongoDB in this study. There are no
database schemas or tables in MongoDB. MongoDB uses
“collection” instead of a table, and “document” instead of
rows to store data. Furthermore, MongoDB uses two
different operations instead of the join operation. These
are nesting documents inside each other and to store a
reference to the other document rather than nesting entire
document.</p>
      </sec>
      <sec id="sec-1-7">
        <title>There are many studies about comparing the performance</title>
        <p>of databases [11] [12] [13] [14]. These studies vary
depending on the data size, the variety of data, the
differences in databases used, implementation languages,
and subjects of the projects. In the study [15], MongoDB,
MySQL, CouchDB, and Redis are compared. It is
declared that MongoDB is performing better among the
comparative database management systems in terms of
the "bulk insert" writing performance. However, MySQL
and MongoDB have similar performance results for
reading operations. Performance parameters between
these DBMSs can be negligible (typically less than 1
second) [15]. However, our test results show that</p>
      </sec>
      <sec id="sec-1-8">
        <title>MongoDB has better performance than MySQL in terms</title>
        <p>of reading and writing as represented in “Results of</p>
      </sec>
      <sec id="sec-1-9">
        <title>Experiments” section. MongoDB is utilized for to store</title>
      </sec>
      <sec id="sec-1-10">
        <title>GPS sensor data and to communicate with the analysis</title>
        <p>tools such as Apache Mahout [11]. ACID operations on</p>
      </sec>
      <sec id="sec-1-11">
        <title>MongoDB and MySQL DBMSs are also applied to</title>
        <p>compare them [12] [13]. According to the results, the use
of the MongoDB has been encouraged for large data
applications, especially for applications of big data [12].</p>
      </sec>
      <sec id="sec-1-12">
        <title>In [14], MongoDB, Raven, CouchDB, Cassandra,</title>
      </sec>
      <sec id="sec-1-13">
        <title>HyperTable, CouchBase, and SQL DBMSs are compared</title>
        <p>in terms of the read, write, delete, and instantiate
operations. According to results of this study[14], all keys
are needed to fetch, MongoDB has better performance
than the others.</p>
        <p>The aim of the experiments is a comparison of the
relational and non-relational DBMSs for utilization an IoT
platform. The system includes IoT devices which publish
a tremendous number of sensor data where servers store
and process them. Performance of reading and writing
tests has been done in both MYSQL and MongoDB in this
study. The test results which are calculated after the
application runs at least three times are compared to find
out where we can store data of IoT considering lowest cost
in terms of throughput.</p>
      </sec>
      <sec id="sec-1-14">
        <title>IoT platform is defined which collects, and processes</title>
        <p>sensor data as seen in Figure 1. The sensor data is
produced by devices/clients and collected by Data</p>
      </sec>
      <sec id="sec-1-15">
        <title>Storage Server (DSS) in server side. The data is stored in</title>
        <p>a DBMS through insert and update operations. Data
Query Server (DQS) in the platform provides an interface
for processing and reporting by Client Application. The
client application sends the data request to the DQS and
they are formed as a query for DBMS. The result of the
query is delivered to the client application. In our case,
enormous data should be stored in the DBMS. Therefore,
writing operations are more important than the reading
operations. The platform has active-active architecture.</p>
      </sec>
      <sec id="sec-1-16">
        <title>Therefore, more than one DSSs can handle the data</title>
        <p>writing transactions. In our platform, our target
throughput is forty messages/milliseconds in average for
writing. Our target throughput and test results compared
with “Results of Experiments” section.</p>
      </sec>
      <sec id="sec-1-17">
        <title>The rest of the article is organized as follows. “Test</title>
        <p>Environment &amp; Methodology” section consists of the
information about the environment of the experiments and
methodology. “Results of Experiments” section presents
the results and graphics from the experiments.
“Conclusions” section summarizes and concludes the
experiments and gives a recommendation for future of this
study.</p>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>TEST ENVIRONMENT &amp; METHODOLOGY</title>
      <sec id="sec-2-1">
        <title>In this paper, research is conducted on the relational and</title>
        <p>non-relational databases. Server and clients of chosen</p>
      </sec>
      <sec id="sec-2-2">
        <title>DBMSs to be used in our experiments are set up</title>
        <p>separately in virtual machines with Ubuntu 16.04 Server
version. Virtual machines are hosted on a physical
machine (i7 6700HQ, 16 GB DDR3 RAM, and SSD disc).</p>
      </sec>
      <sec id="sec-2-3">
        <title>The virtual machines (4 CPU cores, 4 GB RAM) are</title>
        <p>executed on the physical servers as depicted in Figure 2.</p>
      </sec>
      <sec id="sec-2-4">
        <title>A dedicated network is a setup among the servers.</title>
      </sec>
      <sec id="sec-2-5">
        <title>Therefore, it is guaranteed that another network traffıc is</title>
        <p>not disrupted the tests. Both DBMSs are installed on the
computer with SSD for the fastest possible read and write
speed and they are executed separately during the test
scenarios. Multithreaded Java applications for reading and
writing operations on DBMSs are implemented.</p>
      </sec>
      <sec id="sec-2-6">
        <title>Experiments’ constraints are the number of machines,</title>
        <p>number of threads, number of messages, and the size of
the string. These constraints are applied for both DBMSs.
The application is executed on a virtual machine;
therefore, the applications are limited in terms of the CPU
core and memory. In this study, since writing operations
are more important than reading operations, our tests
concentrate on the writing operations. In our tests, data
examples are selected as similar to real-time sensor
applications.</p>
        <p>In this study, two columns are defined including
variablelength string type, an integer type. A primary key column
is automatically defined in MySQL, but it needs to be
defined in MongoDB. The execution time of the tests is
calculated in milliseconds. The number of messages is
measured dividing the total number of messages into the
experiment’s execution time.
80,00
E
M
I
/T60,00
S
E
G
A
S40,00
S
E
M
FO20,00
R
E
BM0,00
U
N
5 0 0 0 0 0 1 0 0 0 0 0 0 1 5 0 0 0 0 0 2 0 0 0 0 0 0 4 0 0 0 0 0 0</p>
        <p>NUMBER OF MESSAGES
1-10 1-20 1-40 1-80
2-10 2-20 2-40 2-80</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>RESULTS OF EXPERIMENTS</title>
      <p>Insert tests are executed with a multithreaded Java
application. The application sends insert SQL request
which contains a string (100 characters) and an integer
value to DBMSs. The application is executed in
computers based on the parameters (number of computer
and threads) as depicted in Figure 3 and Figure 4. Best
throughput is 18.21 messages/millisecond in average for
MySQL such that is succeeded with two computers each
has twenty threads as presented in Figure 3. As it can be
seen that forty threads for one and two computers
utilization have close results. Best throughput will go up
when the number of threads increases. However, when the
number of threads reaches eighty, throughput value begins
to decrease. Therefore, it has been decided that MySQL
can manage forty threads for best results.</p>
      <sec id="sec-3-1">
        <title>Similarly, best throughput is 70.95 messages/millisecond</title>
        <p>in average for MongoDB such that is succeeded with two
computers each has forty threads as presented in Figure 4.</p>
      </sec>
      <sec id="sec-3-2">
        <title>To eliminate the effects of the thread switching, the third</title>
        <p>computer is also used for MongoDB. Throughput for
utilization of the one, two and three computers is 61.22,
70.95, and 61.65 messages/millisecond, respectively. As
it can be seen that two computers’ utilization has the best
performance. Another result can be obtained from the</p>
      </sec>
      <sec id="sec-3-3">
        <title>Figure. 3 and Figure. 4 is a correlation between a number of threads and computers. Best results are obtained for</title>
        <p>M O N G O D B
It is also tested the data with different variable string
length as depicted in Figure 5 and Figure 6. Since best
results are obtained from the two computers, only two
computers cases are tested in these tests. As it can be seen
that 18.21, 9.33, and 6.13 messages/millisecond in
average are obtained for MySQL with 100, 1000, and
2000 string length respectively as depicted in Figure 5.</p>
      </sec>
      <sec id="sec-3-4">
        <title>Similarly, previous results, twenty threads utilization for</title>
        <p>MySQL has best throughput results. For MongoDB, forty
threads utilization has best throughput results; 70.95,
49.04, and 39.85 messages/millisecond in average are
obtained with 100, 1000, and string (2000 characters)
respectively as depicted in Figure 6. MongoDB DBMS
has about four times better results than MYSQL. As it can
be seen that length of the message is one of the most
important parameters. Such as when the length is doubled,
throughput is decreased about twenty percent.</p>
      </sec>
      <sec id="sec-3-5">
        <title>Select tests are also executed with the same multithreaded</title>
      </sec>
      <sec id="sec-3-6">
        <title>Java application. The application retrieves data from two</title>
      </sec>
      <sec id="sec-3-7">
        <title>DBMSs. The application is executed on a computer and two computers with a different number of the threads as depicted in Figure 7 and Figure 8. MySQL results are not</title>
        <p>M O N G O D B
E20,00
M
I
T
/
S
E
G
A
SS10,00
E
M
F
O
R
E
BM0,00
U
N
E80,00
M
I
T
/S60,00
E
G
A
SS40,00
E
M
F
O20,00
R
E
B
UNM0,00
stable as MongoDB. Best throughput is 60.09
messages/millisecond and 44.34 in average for MySQL
with one computer has eighty threads. In MongoDB, the
best result is 68.68 messages/millisecond and 58.61
messages/millisecond in average is succeeded with three
computers each has eighty threads as depicted in Figure 8.</p>
      </sec>
      <sec id="sec-3-8">
        <title>Furthermore, it has been concluded that MongoDB can manage eighty threads for reading operations.</title>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>CONCLUSIONS</title>
      <p>Our IoT platform requires that forty
messages/milliseconds in average should be written to the
chosen DBMS. Otherwise, the number of messages
waiting in the queue for writing will increase and it can
cause memory problems. In the IoT platform,
activeactive architecture is applied. Therefore, more than one
computer can write to DBMS at the same time. Test
results show that MongoDB has better performance than
the MYSQL in terms of both writing and reading
operations. In the IoT Platform, the message payload is
varying between 100 bytes and 200 bytes. For these types
of messages, MongoDB has 70.95 messages/milliseconds
in average and MySQL has 18.21 messages/milliseconds
in average for writing. As it can be seen that only</p>
      <sec id="sec-4-1">
        <title>MongoDB satisfy the target expectations 40 messages/milliseconds in average. MongoDB also can satisfy the requirement with a single machine which has 61.22 messages/milliseconds throughput for writing.</title>
        <p>M O N G O D B
1 0 0 . 0 0 0
1-10
2-10
3-10
2 5 0 . 0 0 0 5 0 0 . 0 0 0 1 . 0 0 0 . 0 0 0 2 . 0 0 0 . 0 0 0
NUMBER OF MESSAGES
1-15 1-20 1-40 1-80
2-15 2-20 2-40 2-80
3-15 3-20 3-40 3-80</p>
      </sec>
      <sec id="sec-4-2">
        <title>The DQS in the IoT platform applies reading operations</title>
        <p>on the DBMS. Test results show that MongoDB has better
throughput than the MySQL. MongoDB has 55.07
messages/millisecond in average and MySQL has 46.66
messages/millisecond in average for two computers.</p>
      </sec>
      <sec id="sec-4-3">
        <title>Therefore, MongoDB is selected as DBMS for writing and reading operations in the IoT Platform.</title>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>ACKNOWLEDGEMENT</title>
      <sec id="sec-5-1">
        <title>These results preliminary study of the project proposal</title>
        <p>applied to TUBITAK 1505 University Industry</p>
      </sec>
      <sec id="sec-5-2">
        <title>Collaboration Grant Program and the study is supported by EMKO Electronic A.Ş located in Bursa, Turkey.</title>
        <p>“MongoDB
https://docs.mongodb.com/manual/. .</p>
        <sec id="sec-5-2-1">
          <title>Documentation,”</title>
          <p>“Cassandra.” [Online].
http://cassandra.apache.org/.
“Amazon SimpleDB.”
https://aws.amazon.com/simpledb/.</p>
        </sec>
        <sec id="sec-5-2-2">
          <title>Available:</title>
          <p>[Online].</p>
        </sec>
        <sec id="sec-5-2-3">
          <title>Available:</title>
          <p>“Redis.” [Online]. Available: https://redis.io/.</p>
        </sec>
        <sec id="sec-5-2-4">
          <title>G. Aydin, I. R. Hallac, and B. Karakus, “Architecture and implementation of a scalable sensor data storage and analysis system using cloud computing and big data technologies,” J. Sensors, vol. 2015, 2015.</title>
        </sec>
        <sec id="sec-5-2-5">
          <title>S. Chickerur, A. Goudar, and A. Kinnerkar, “Comparison of</title>
        </sec>
        <sec id="sec-5-2-6">
          <title>Relational Database with Document-Oriented Database (MongoDB) for Big Data Applications,” Proc. - 8th Int. Conf.</title>
          <p>Adv. Softw. Eng. Its Appl. ASEA 2015, pp. 41–47, 2016.</p>
        </sec>
        <sec id="sec-5-2-7">
          <title>Z. Parker, S. Poe, and S. V. Vrbsky, “Comparing NoSQL</title>
          <p>MongoDB to an SQL DB,” Proc. 51st ACM Southeast Conf.
ACMSE ’13, p. 1, 2013.</p>
        </sec>
        <sec id="sec-5-2-8">
          <title>Y. Li and S. Manoharan, “A performance comparison of SQL</title>
          <p>and NoSQL databases,” IEEE Pacific RIM Conf. Commun.
Comput. Signal Process. - Proc., no. August 2013, pp. 15–19,
2013.</p>
        </sec>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>[1] “IoT.” [Online]. Available: https://connectedtechnbiz.wordpress.com/tag/internet-ofthings/.</mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <source>“Gartner Says 6.4 Billion Connected 'Things' Will Be in Use in 2016, Up 30 Percent From</source>
          <year>2015</year>
          ,”
          <year>2015</year>
          . [Online].
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>Available: http://www.gartner.com/newsroom/id/3165317.</mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <string-name>
            <given-names>K.</given-names>
            <surname>Chodorow</surname>
          </string-name>
          ,
          <string-name>
            <surname>Mongo</surname>
            <given-names>DB</given-names>
          </string-name>
          :
          <article-title>The Definitive Guide</article-title>
          .
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <given-names>P. T. A.</given-names>
            <surname>Mai</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. K.</given-names>
            <surname>Nurminen</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Di Francesco</surname>
          </string-name>
          , “
          <article-title>Cloud databases for internet-of-things data</article-title>
          ,
          <source>” Proc. - 2014 IEEE Int.</source>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <string-name>
            <given-names>Conf. Internet</given-names>
            <surname>Things</surname>
          </string-name>
          ,
          <year>iThings 2014</year>
          ,
          <source>2014 IEEE Int. Conf.</source>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          <string-name>
            <given-names>Green</given-names>
            <surname>Comput</surname>
          </string-name>
          .
          <source>Commun. GreenCom</source>
          <year>2014</year>
          2014
          <string-name>
            <given-names>IEEE</given-names>
            <surname>Int.</surname>
          </string-name>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <string-name>
            <surname>Conf</surname>
          </string-name>
          .
          <article-title>Cyber-Physical-Social Comput</article-title>
          .
          <source>CPS 20</source>
          , no. iThings, pp.
          <fpage>117</fpage>
          -
          <lpage>124</lpage>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <article-title>Gizem Kiraz has completed her undergraduate (2016) in Computer Engineering Department from the Pamukkale University (PAÜ). Her postgraduate has started (</article-title>
          <year>2017</year>
          ) in Computer Engineering Department from the Uludag University.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          <string-name>
            <given-names>Cengiz</given-names>
            <surname>Togay</surname>
          </string-name>
          ,
          <source>Ph.D. is an assistant professor at</source>
          Uludag University's Computer Engineering Department.
          <article-title>He obtained his undergraduate (1999) and MS (</article-title>
          <year>2001</year>
          <article-title>) in computer engineering from the Canakkale Onsekiz Mart University and</article-title>
          his
          <source>PhD</source>
          (
          <year>2008</year>
          ) in computer engineering department from Middle East Technical University.
          <article-title>He has national and international patent applications, papers, articles and projects about Software Engineering</article-title>
          , Secure Communications, Smart Cards, and
          <article-title>Internet of Things(IoT).</article-title>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>