<!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 />
    <article-meta>
      <title-group>
        <article-title>Polyglot database architectures = polyglot challenges</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Lena Wiese</string-name>
          <email>lena.wiese@uni-goettingen.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Institute of Computer Science University of Gottingen Goldschmidtstra e 7 37077 Gottingen</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <fpage>422</fpage>
      <lpage>426</lpage>
      <abstract>
        <p>We categorize polyglot database architectures into three types (polyglot persistence, lambda architecture and multi-model databases) and discuss their advantages and disadvantages. Copyright c 2015 by the paper's authors. Copying permitted only for private and academic purposes. In: R. Bergmann, S. Gorg, G. Muller (Eds.): Proceedings of the LWA 2015 Workshops: KDML, FGWM, IR, and FGDB. Trier, Germany, 7.-9. October 2015, published at http://ceur-ws.org</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>When designing the data management layer for an application, several database
requirements may be contradictory. For example, regarding access patterns some
data might be accessed by write-heavy workloads while others are accessed by
read-heavy workloads. Regarding the data model, some data might be of a
different structure than other data; for example, in an application processing both
social network data and order or billing data, the former might usually be
graphstructured while the latter might be semi-structured data. Regarding the access
method, a web application might want to access data via a REST interface while
another application might prefer data access with query language. It is hence
worthwhile to consider a database and storage architecture that includes all these
requirements. We describe three option for polyglot database architectures in the
following three sections.
1.1</p>
    </sec>
    <sec id="sec-2">
      <title>Polyglot Persistence</title>
      <p>
        Instead of choosing just one single database management system to store the
entire data, so-called polyglot persistence could be a viable option to satisfy all
requirements towards a modern data management infrastructure. Polyglot
persistence (a term coined in [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]) denotes that one can choose as many databases as
needed so that all requirements are satis ed. Polyglot persistence can in
particular be an optimal solution when backward-compatibility with a legacy
application must be ensured. The new database system can run alongside the legacy
database system; while the legacy application still remains fully functional, novel
requirements can be taken into account by using the new database system.
      </p>
      <p>
        An implementation of a data processing system that connects to several data
sources and integrates and merges data from these sources is Apache Drill [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
Apache Drill is inspired by the ideas developed in Google's Dremel system [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
      </p>
      <p>It should obviously be avoided to push the burden of all of these query
handling and database synchronization task to the application level { that is, in
the end to the programmers that maintain the data processing applications.
Instead it is usually better to introduce an integration layer. The integration layer
then takes care of processing the queries { decomposing queries in to several
subqueries, redirecting queries to the appropriate databases and recombining
the results obtained from the accessed databases; ideally, the integration layer
should o er several access methods, and should be able to parse all the di erent
query languages of the underlying database systems as well as potentially
translate queries into other query languages. Moreover, the integration layer should
ensure cross-database consistency: it must synchronize data in the di erent
databases by propagating additions, modi cations or deletions among them.</p>
      <p>Polyglot persistence however comes with severe disadvantages:
{ Uniform access: There is no unique query interface or query language, and
hence access to the database systems is not uni ed and requires knowledge
of all needed database access methods.
{ Consistency: Cross-database consistency is a major challenge because
referential integrity must be ensured across databases (for example if a record in
one database references a record in another database) and in case data are
duplicated (and hence occur in di erent representation in several databases
at the same time) the duplicates have to be updated or deleted in unison.
{ Interoperability: The underlying database systems are developed
independently. Newer versions of databases may not be interoperable with the
integration layer and the administrator has to keep track of frequent updates.
{ Logical Redundancy: Logical redundancy can only be avoided with a database
design that strictly assigns non-intersecting subsets of the data to di erent
databases. This might contradict some access requirements of users.
{ Security: Access control must be enforced by the integration layer and all
connected databases have to be con gured to only allow restricted access.
1.2</p>
    </sec>
    <sec id="sec-3">
      <title>Lambda Architecture</title>
      <p>
        When real-time (stream) data processing is a requirement, a combination of a
slower batch processing layer and a speedier stream processing layer might be
appropriate. This architecture has been recently termed lambda architecture
[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. The lambda architecture processes a continuous ow of data in the following
three layers:
      </p>
      <p>Speed Layer: The speed layer collects only the most recent data. As soon
as data have been included in the other two layers (batch layer and serving
layer), the data can be discarded from the speed layer dataset. The speed
layer incrementally computes some results over its dataset and delivers these
results in several real-time views; that is, the speed layer is able to adapt
his output based on the constantly changing data set. Due to the relatively
small size of the speed layer data set, the runtime penalty of incremental
computations are still within acceptable limits.</p>
      <p>Batch Layer: The batch layer stores all data in an append-only and
immutable fashion in a so-called master dataset. It evaluates functions over the
entire dataset; the results are delivered in so-called batch views.
Computing the batch views is an inherently slow process. Hence, recent data will
only be gradually re ected in the results.</p>
      <p>Serving Layer: The serving layer makes batch views accessible to user
queries. This can for example be achieved by maintaining indexes over the
batch views.</p>
      <p>User queries can be answered by merging data from both the appropriate batch
views and the appropriate real-time views.</p>
      <p>
        An open source implementation following the ideas of a lambda architecture
is Apache Druid [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] that processes streaming data in real-time nodes and batch
data in historical nodes.
      </p>
      <p>In practice, the lambda architecture often relies on external storage (\deep
storage" in case of Druid) or stream processors (on the input side). Due to this
it only has slight advantages over the polyglot persistence approach. Moreover
this architecture is mostly geared towards real-time processing of data and less
to ad-hoc querying.
1.3</p>
    </sec>
    <sec id="sec-4">
      <title>Multi-Model Databases</title>
      <p>Relying on di erent storage backends increases the overall complexity of the
system and raises concerns like inter-database consistency, inter-database
transactions and interoperability as well as version compatibility and security. It might
hence be advantageous to use a database system that stores data in a single
store but provides access to the data with di erent APIs according to di erent
data models. Databases o ering this feature have been termed multi-model
databases. Multi-model databases either support di erent data models directly
inside the database engine or they o er layers for additional data models on top
of a single-model engine.</p>
      <p>
        Two open source multi-model databases are OrientDB [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] and ArangoDB
[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. OrientDB o ers a document API, an object API, and a graph API; it o ers
extensions of the SQL standard to interact will all three APIs. Alternatively,
Java APIs are available. The Java Graph API is compliant with Tinkerpop [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ].
ArangoDB is a multi-model database with a graph API, a key-value API and a
document API. Its query language AQL (ArangoDB query language) resembles
SQL in parts but adds several database-speci c extensions to it.
      </p>
      <p>Several advantages come along with this single-database multi-model
approach:
{ Reduced database administration: maintaining a single database installation
is easier than maintaining several di erent database installations in parallel,
keeping up with their newest versions and ensure inter-database
compatibility. Con guration and ne-tuning database settings can be geared towards
a single database system.
{ Reduced user administration: In a multi-model database only one level of
user management (including authentication and authorization) is necessary.
{ Integrated low-level components: Low-level database components (like
memory bu er management) can be shared between the di erent data models in a
multi-model database. In contrast, polyglot persistence with several database
systems requires each database engine to have its own low-level components.
{ Improved consistency: With a single database engine, consistency (including
synchronization and con ict resolution in a distributed system) is a lot easier
to ensure than consistency across several di erent database platforms.
{ Reliability and fault tolerance: Backup just has to be set up for a single
database and upon recovery only a single database has to be brought up
to date. Intra-database fault handling (like hinted hando ) is less complex
than implementing fault handling across di erent databases.
{ Scalability: Data partitioning (in particular \auto-sharding") as well as
profiting from data locality can best be con gured in a single database system
{ as opposed to more complex partitioning design when data are stored in
di erent distributed database systems.
{ Easier application development: Programming e orts regarding database
administration, data models and query languages can focus on a single database
system. Connections (and optimizations like connection pooling) have to be
managed only for a single database installation.
2</p>
      <p>
        Conclusion
Data come in di erent formats and data models. Modern data stores support
advanced data management in the native data models [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. Polyglot database
architectures can handle several di erent data models at a time.
      </p>
      <p>Polyglot persistence can respond to di ering user demands; however it comes
at the cost of increased administration overhead and more complex con
guration (in particular in terms of security). Hence, polyglot persistence can only
be recommended if several diverse data models have to be supported and the
maintenance overhead can be managed.</p>
      <p>The lambda architecture is a good choice for real-time data analytics but also
relies on external data storage with similar disadvantages as polyglot persistence.</p>
      <p>Multi-model databases are a good choice if only a limited set of data models
is required by the accessing applications. Multi-model excel in terms of
administration e ort and security and hence are optimal, when only the limited set of
data formats supported by the multi-model database are needed.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>1. ArangoDB: Https://www.arangodb.com/</mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>2. Drill: Http://drill.apache.org/</mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>3. Druid: Http://druid.io/</mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Fowler</surname>
            ,
            <given-names>M.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sadalage</surname>
            ,
            <given-names>P.J.:</given-names>
          </string-name>
          <article-title>NoSQL Distilled: A Brief Guide to the Emerging World of Polyglot Persistence</article-title>
          . Prentice
          <string-name>
            <surname>Hall</surname>
          </string-name>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Marz</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Warren</surname>
          </string-name>
          , J.:
          <article-title>Big Data: Principles and best practices of scalable realtime data systems</article-title>
          .
          <source>Manning Publications Co</source>
          .
          <article-title>(</article-title>
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Melnik</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gubarev</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Long</surname>
            ,
            <given-names>J.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Romer</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shivakumar</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tolton</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vassilakis</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          :
          <article-title>Dremel: interactive analysis of web-scale datasets</article-title>
          .
          <source>Proceedings of the VLDB Endowment</source>
          <volume>3</volume>
          (
          <issue>1-2</issue>
          ),
          <volume>330</volume>
          {
          <fpage>339</fpage>
          (
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>7. OrientDB: Http://orientdb.com/</mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>8. Tinkerpop: Http://tinkerpop.incubator.apache.org/</mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Wiese</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          :
          <article-title>Advanced Data Management { for SQL, NoSQL, Cloud</article-title>
          and
          <string-name>
            <given-names>Distributed</given-names>
            <surname>Databases</surname>
          </string-name>
          . DeGruyter/Oldenbourg (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>