summaryrefslogtreecommitdiff
path: root/lib/mnesia/doc/src/Mnesia_overview.xml
blob: a021181299e31693c3195c146e8ccab98b57a5ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>
  <header>
    <copyright>
      <year>1997</year><year>2016</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

    </legalnotice>

    <title>Overview</title>
    <prepared>Claes Wikstr&ouml;m, Hans Nilsson and H&aring;kan Mattsson</prepared>
    <responsible>Bjarne D&auml;cker</responsible>
    <docno></docno>
    <approved>Bjarne D&auml;cker</approved>
    <checked>Bjarne D&auml;cker</checked>
    <date></date>
    <rev>C</rev>
    <file>Mnesia_overview.xml</file>
  </header>

    <p>The management of data in telecommunications systems has many
      aspects of which some, but not all, are addressed by traditional
      Database Management Systems (DBMSs). In particular, the
      high level of fault tolerance required in many nonstop
      systems, combined with requirements on the DBMS to run in the same
      address space as the applications, have led us to implement a new
      DBMS, called Mnesia.</p>
    <p>Mnesia is implemented in, and tightly coupled to Erlang.
      It provides the functionality that is necessary for the
      implementation of fault-tolerant telecommunications systems.</p>
    <p>Mnesia is a multiuser distributed DBMS specifically designed for
      industrial-grade telecommunications applications written in Erlang,
      which is also the intended target language.
      Mnesia tries to address all the data management issues required for
      typical telecommunications systems and has a number of features not
      normally found in traditional DBMSs.</p>
    <p>Telecommunications applications need a mix of a broad range
      of features generally not provided by traditional DBMSs.
      Mnesia is designed to meet requirements such as:</p>
    <list type="bulleted">
      <item>Fast real-time key-value lookup
      </item>
      <item>Complex non-real-time queries
        (mainly for operation and maintenance tasks)
      </item>
      <item>Distributed data
        (due to the distributed nature of the applications)
      </item>
      <item>High fault tolerance
      </item>
      <item>Dynamic reconfiguration
      </item>
      <item>Complex objects
      </item>
    </list>
    <p>Mnesia addresses the typical data management issues required for
      telecommunications applications which sets it apart from most other DBMSs.
      It combines many concepts found in traditional DBMSs, such as transactions
      and queries, with concepts found in data management systems for
      telecommunications applications such as:</p>
      <list type="bulleted">
        <item>Fast real-time operations
        </item>
        <item>Configurable replication for fault tolerance
        </item>
        <item>Dynamic reconfiguration without service disruption
        </item>
      </list>
    <p>Mnesia is also unique due to its tight coupling to
      Erlang. It almost turns Erlang into a database programming
      language, which yields many benefits. The foremost is that
      the impedance mismatch between the data format used by the DBMS
      and the data format used by the programming language, which is used
      to manipulate the data, completely disappears.</p>

  <section>
    <title>The Mnesia Database Management System</title>
    <section>
      <title>Features</title>
      <p>Mnesia has the following features that combine to
        produce a fault-tolerant distributed database management
        system (DBMS) written in Erlang:
        </p>
      <list type="bulleted">
        <item>Database schema can be dynamically reconfigured at runtime.
        </item>
        <item>Tables can be declared to have properties such as location,
          replication, and persistence.
        </item>
        <item>Tables can be moved or replicated to several nodes to improve
          fault tolerance. Other nodes in the system can still access the
          tables to read, write, and delete records.
        </item>
        <item>Table locations are transparent to the programmer.
          Programs address table names and the system itself keeps track of
          table locations.
        </item>
        <item>Transactions can be distributed and multiple
          operations can be executed within a single transaction.
        </item>
        <item>Multiple transactions can run concurrently and their execution
          is fully synchronized by Mnesia, ensuring that no
          two processes manipulate the same data simultaneously.
        </item>
        <item>Transactions can be assigned the property of being executed on
          all nodes in the system, or on none.
        </item>
        <item>Transactions can be bypassed using dirty operations,
          which reduce overheads and run fast.
        </item>
      </list>
      <p>All of the above features are described in detail
        in the coming sections.</p>
    </section>

    <section>
      <title>Query List Comprehension</title>
      <p>Query List Comprehension (QLC) can be used with Mnesia
        to produce specialized functions that enhance its operational
        ability. QLC has its own documentation as part
        of the OTP documentation set. The main QLC advantages
        when used with Mnesia are:</p>
      <list type="bulleted">
        <item>QLC can optimize the query compiler for Mnesia,
          essentially making the system more efficient.
        </item>
        <item>QLC can be used as a database programming
          language for Mnesia. It includes a notation called list
          comprehensions which can be used to execute complex database
          queries over a set of tables.
        </item>
      </list>
      <p>For more information about QLC, please see the
        <seeerl marker="stdlib:qlc">qlc</seeerl> manual page
        in STDLIB.</p>
    </section>

    <section>
      <title>When to Use Mnesia</title>
        <p>Mnesia is a great fit for applications that:</p>
        <list type="bulleted">
          <item>Need to replicate data.
          </item>
          <item>Perform complex data queries.
          </item>
          <item>Need to use atomic transactions to
            safely update several records simultaneously.
          </item>
          <item>Require soft real-time characteristics.
          </item>
        </list>
        <p>Mnesia is not as appropriate for applications that:</p>
        <list type="bulleted">
          <item>Process plain text or binary data files.
          </item>
          <item>Merely need a lookup dictionary that
            can be stored on disc. Such applications may use the standard
            library module <c>dets</c>, which is a disc-based version
            of the <c>ets</c> module. For more information about <c>dets</c>,
            please see the <seeerl marker="stdlib:dets">dets</seeerl>
            manual page in STDLIB.
          </item>
          <item>Need disc logging facilities.
            Such applications may use the module <c>disk_log</c>.
            For more information about <c>disk_log</c>, please see the
            <seeerl marker="kernel:disk_log">disk_log</seeerl>
            manual page in Kernel.
          </item>
          <item>Require hard real-time characteristics.
          </item>
        </list>
    </section>
  </section>
</chapter>