<!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>SCME,
Project Exhibitions, Posters and Demos, and Doctoral Consortium, November</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Impact of read and write operations on NoSQL schema design: First insights</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>André Conrad</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Uta Störl</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Hagen</institution>
          ,
          <addr-line>Universitätsstraße 47, 58097 Hagen</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>r80_w20 Read Optimized Schema</institution>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2023</year>
      </pub-date>
      <volume>0</volume>
      <issue>1</issue>
      <fpage>6</fpage>
      <lpage>09</lpage>
      <abstract>
        <p>Document stores like MongoDB are among the most popular NoSQL data stores. Due to the nested document structure and possible redundancy, a large amount of alternative modeling possibilities arise in contrast to relational data stores, even for simple applications. Therefore, designing an optimal schema is a complex task. In [1] we presented a visionary approach to automatic schema migration and optimization for migrating relational data stores to various NoSQL stores. This is essentially based on an in-depth data and workload analysis. A big challenge, however, is to find the optimal compromise between read and write optimization. In this paper, we show the impact of diferent workload profiles (mix of read and write operations) on the schema design using initial measurements. This illustrates the fundamental need to consider realistic workload profiles in the schema design and optimization process.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Document Store</kwd>
        <kwd>NoSQL Schema Design</kwd>
        <kwd>Database Benchmark</kwd>
        <kwd>Optimization</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        NoSQL data stores such as MongoDB are gaining in popularity. However, designing a suitable
schema is a major challenge due to the large number of modeling alternatives, which is often
based on a trial and error approach. Thus, there are several works that address automatic
schema optimization and design, respectively [
        <xref ref-type="bibr" rid="ref1 ref2 ref3 ref4">1, 2, 3, 4</xref>
        ].
      </p>
      <p>For the evaluation of automatically generated, but also manually created schemas, it is
therefore absolutely necessary to use realistic workload profiles in order to be able to estimate
the behavior in a productive environment.</p>
      <p>Contribution: First measurements showing the diferent behavior of realistic workload profiles
compared to single execution (one by one) of queries.</p>
      <p>This paper is organized as follows: Section 2 presents work discussing the evaluation of diferent
schema modeling and optimization approaches. Section 3 describes the environment and the
results of our first measurements. Section 4 provides the conclusion as well as an outlook to
our future work.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Related work</title>
      <p>In the following, related work on the evaluation of schema modeling and optimization
approaches is described. Since the focus of this paper is on the evaluation and the necessity of
considering realistic workload profiles, only papers regarding the evaluation of NoSQL schema
design methods are considered.</p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] an e-commerce scenario is used. They define 6 diferent access operations. The workload
profile has been described in detail, but it is not clearly defined if a concurrent workload with
multiple threads (clients) is used. In [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] the Rice University Bidding System (RUBiS), a web
application benchmark, was adapted from [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. It consists of a read-only workload with 7 queries
and a mixed workload with 9 additional write queries. Although the measurements were
originally performed with diferent numbers of threads (clients), this is not discussed in detail.
In [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] and [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], the RUBiS scenario is also used, but again without going into detail about the
measurements (number of threads) and only with read queries. The authors of [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] use the
e-commerce and RUBiS scenario for comparison with other work, but also without going into
detail about how measurements are made with respect to the diferent workload profiles and
number of threads (clients).
      </p>
      <p>None of the works describes in detail how the measurements were made with respect to the
workload. In particular, the number of concurrent threads (clients) is not discussed. Therefore,
it is dificult to understand exactly what the benchmark environment looks like.
3. Experimental environment and results
The goal of this work is to show the impact of executing queries one by one compared to diferent
workload mixes of read and write queries on multiple clients. This is done using two diefrent
schema designs. One has been optimized for read-only queries and one for write-only queries.</p>
      <p>The schema of a prototypical application1 to manage digital print media is used because it
is a real world scenario that is not too complex but has suficiently complex relationships to
illustrate the impact on the two schema designs (see Figure 1).</p>
      <p>
        The test data was generated using our test data generator [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. Figure 1 shows the conceptual
model of the application.
      </p>
      <p>Author
id
first_name
last_name
birthday
pk id
name</p>
      <p>Publisher
pk id</p>
      <p>Item</p>
      <p>MetaData</p>
      <p>Page
pk id
title
release_date
pk id
content
size
pk id
name</p>
      <p>Collection
pk</p>
      <p>For modeling the physical schemas and defining diferent workload mixes, 3 read and 3 write
queries are used: (1) Given a Collection.id, return the Collection, related Items, Metadata,
1https://sammlungen.hebis.de/Handbuecher/
Publisher and Authors. (2) Given an Author.id, return the Author, related Items, Publisher
and Collections. (3) Given an Item.id, return the Item related Metadata, Pages, Publisher
and Authors. (4) Given an existing Publisher.id and multiple existing Collection.ids, add one
or more new Authors and a new Item with corresponding Metadata and Pages. (5) Given
multiple existing Item.ids and Collection.ids, add the Items to the Collections. (6) Given an
existing Item.id and changed Metadata.title, update the Metadata.</p>
      <p>Due to the various relationship modeling possibilities, designing the optimal schema for a
given workload in document stores such as MongoDB is a complex task.</p>
      <p>Here, optimizations with respect to reading queries result in redundancy in the Collection,
Item and Author documents so that all attributes needed for the queries are present in the
corresponding documents. This increases the complexity of the write queries (4 to 6) since
redundant data must be written in several collections. To avoid inconsistencies, transactions
were used for the write operations in the read-optimized schema.</p>
      <p>For the optimization of the write queries, redundancy must be avoided, since the performance
decreases the more redundant data has to be written. Here, only 5 is realized as a transaction,
since several documents are updated, which ensures a rollback in the case of an error.</p>
      <p>
        All measurements were done on a single node of MongoDB version 6.0.9 with 64 GB RAM and
16 CPU cores. For the benchmark, py-tpcc2, a Python implementation of the TPC-C3 benchmark
was extended, which already has a MongoDB driver as part of performance measurements on
multi-document transactions [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. For the measurements regarding workload mixes diferent
probabilities of the queries are used (from 99% read and 1% write to 1% read and 99% write).
r90_w10, for example, means 90% read (1, 2 or 3) and 10% write (4, 5 or 6).
      </p>
      <p>Results: First, it can be observed that for sequential execution (single thread) of queries, the
read queries in the read-optimized schema and the write queries in the write-optimized schema
always have the best performance (see 3 and 6 one_by_one in Figure 2 as an example).</p>
      <p>However, this may be diferent for individual queries when running mixed workloads on
multiple concurrent clients. For example, query 6 (write) performs better in the read-optimized
schema than in the write-optimized schema for mixed workloads (see Figure 2b).
. 30,000
inM 20,000
/
ise 10,000
r
ueQ 0</p>
      <p>Finally, Figure 3 shows the behavior of diferent workload mixes on the read and write
optimized schemas. Here, as expected, the correspondingly optimized schemas show better
performance for a higher amount of read or write operations. For better readability the plot has been
split, since the performance is much higher in the read-optimized schema for workload r99_w1.
2https://github.com/apavlo/py-tpcc
3https://tpc.org/tpcc/
r20_w80
r1_w99</p>
    </sec>
    <sec id="sec-3">
      <title>4. Conclusion and future work</title>
      <p>Based on initial measurements, it could be shown that when looking at the execution
performance of individual queries, significant diferences exist between queries executed sequentially
(one by one) or, in a more realistic scenario, on several concurrent clients in a workload mix.</p>
      <p>This shows the importance to consider realistic workload profiles (mixes) with concurrent
clients when evaluating schema optimization approaches.</p>
      <p>There are many dimensions to be taken into account when executing database benchmarks.
We therefore plan to perform more extensive measurements. Our current vision is to use a
MongoDB cluster with replication and sharding. We also plan to further examine important
variables and their efects, such as the diferent number of clients, diferent document sizes, and
diferent number of related documents.</p>
    </sec>
    <sec id="sec-4">
      <title>Acknowledgments References</title>
      <p>This work has been funded by Deutsche Forschungsgemeinschaft (DFG, German Research
Foundation) grant #385808805.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>A.</given-names>
            <surname>Conrad</surname>
          </string-name>
          , et al.,
          <source>Towards Automated Schema Optimization, in: ER'21</source>
          ,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>V.</given-names>
            <surname>Reniers</surname>
          </string-name>
          , et al.,
          <string-name>
            <given-names>A</given-names>
            <surname>Workload-Driven Document Database Schema</surname>
          </string-name>
          <article-title>Recommender (DBSR)</article-title>
          ,
          <source>in: ER'20</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>L.</given-names>
            <surname>Chen</surname>
          </string-name>
          , et al.,
          <article-title>A workload-driven method for designing aggregate-oriented NoSQL databases</article-title>
          , DKE'
          <volume>22</volume>
          (
          <year>2022</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>M.</given-names>
            <surname>Hewasinghage</surname>
          </string-name>
          , et al.,
          <article-title>Automated database design for document stores with multicriteria optimization</article-title>
          ,
          <source>KAIS'23</source>
          (
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>C. de Lima</surname>
          </string-name>
          , et al.,
          <article-title>On proposing and evaluating a NoSQL document database logical approach</article-title>
          , IJWIS'
          <volume>16</volume>
          (
          <year>2016</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>M. J.</given-names>
            <surname>Mior</surname>
          </string-name>
          , et al.,
          <article-title>NoSE: Schema design for NoSQL applications</article-title>
          , in: ICDE'
          <fpage>16</fpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>E.</given-names>
            <surname>Cecchet</surname>
          </string-name>
          , et al.,
          <article-title>Performance and scalability of EJB applications</article-title>
          , in: OOPSLA'
          <fpage>02</fpage>
          ,
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>V.</given-names>
            <surname>Restat</surname>
          </string-name>
          , et al.,
          <article-title>GouDa - generation of universal data sets: improving analysis and evaluation of data preparation pipelines</article-title>
          ,
          <source>in: DEEM'22</source>
          ,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>A.</given-names>
            <surname>Kamsky</surname>
          </string-name>
          ,
          <article-title>Adapting TPC-C Benchmark to Measure Performance of Multi-Document Transactions in MongoDB</article-title>
          , VLDB'
          <volume>19</volume>
          (
          <year>2019</year>
          ).
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>