<html>
<head>
<base href="https://wiki.asterisk.org/wiki">
<link rel="stylesheet" href="/wiki/s/2041/1/7/_/styles/combined.css?spaceKey=TOP&forWysiwyg=true" type="text/css">
</head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
<h2><a href="https://wiki.asterisk.org/wiki/display/TOP/State+Replicator+Persistence+Options">State Replicator Persistence Options</a></h2>
<h4>Page <b>edited</b> by <a href="https://wiki.asterisk.org/wiki/display/~khunt">Ken Hunt</a>
</h4>
<br/>
<h4>Changes (1)</h4>
<div id="page-diffs">
<table class="diff" cellpadding="0" cellspacing="0">
<tr><td class="diff-unchanged" >h4. Introduction <br> <br></td></tr>
<tr><td class="diff-changed-lines" >Each major component of an Asterisk SCF system has a corresponding State Replicator component. This State Replicator component is a <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">sync</span> <span class="diff-added-words"style="background-color: #dfd;">sink</span> for current state changes from an active component, and a source of state changes for standby components. Initial implementations of the State Replicator components are based on a simple C++ template which uses an in-memory store of the replicated state. The state store is required to be able to provide the current state to late-joining backup components which may not have been online when the state updates were originally generated. <br></td></tr>
<tr><td class="diff-unchanged" > <br>{gliffy:name=Basic State Replication|version=13} <br></td></tr>
<tr><td class="diff-snipped" >...<br></td></tr>
</table>
</div> <h4>Full Content</h4>
<div class="notificationGreySide">
<h4><a name="StateReplicatorPersistenceOptions-Introduction"></a>Introduction</h4>
<p>Each major component of an Asterisk SCF system has a corresponding State Replicator component. This State Replicator component is a sink for current state changes from an active component, and a source of state changes for standby components. Initial implementations of the State Replicator components are based on a simple C++ template which uses an in-memory store of the replicated state. The state store is required to be able to provide the current state to late-joining backup components which may not have been online when the state updates were originally generated. </p>
<map name='GLIFFY_MAP_12550532_Basic_State_Replication'></map>
<table width="100%">
<tr>
<td align="left">
<table>
<caption align="bottom">
</caption>
<tr>
<td>
<img style="border: none; width: 400px; height: 200px;"
usemap="#GLIFFY_MAP_12550532_Basic_State_Replication"
src="/wiki/download/attachments/12550532/Basic+State+Replication.png?version=13&modificationDate=1299872325217"
alt="A&#32;Gliffy&#32;Diagram&#32;named&#58;&#32;Basic&#32;State&#32;Replication"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>Each state replication component, in its current implementation, represents a single point of failure in that the State Replicators themselves are not replicated. All of the State Replicators are, however, built to operate against define APIs. This allows us to address the robustness of the state replication mechanisms in the abstract. In other words, as we look to increase the robustness of the system, we can focus on replicating generic state, independent of the particular components involved. To provide a complete replication platform, we desire to exploit a general purpose, off-the-shelf solution for persisting data and replicating that data across systems. (Note: We fully expect 3rd parties may have reasons to build State Replicators on other persistence platforms than the one we choose to use.)</p>
<h4><a name="StateReplicatorPersistenceOptions-CandidateTechnologies"></a>Candidate Technologies</h4>
<p>We want to identify an open-source solution that can do the following:</p>
<ul class="alternate" type="square">
        <li>Persist the dynamic data in near-real-time<br/>
(or give the appearance of persistence, in that another process can take over in the event of failure of an Asterisk SCF State Replicator.)</li>
        <li>Replicate the state store across servers</li>
</ul>
<p>And we want the solution to have the following characteristics: </p>
<ul class="alternate" type="square">
        <li>Simple to deploy</li>
        <li>Simple to program to</li>
        <li>Lightweight install</li>
</ul>
<h5><a name="StateReplicatorPersistenceOptions-TheRelationalDatabaseQuestion"></a>The Relational Database Question </h5>
<p>The first choice is to decide if the solution would benefit from a relational database. While it's common for relational database systems to include a replication capability, there are no other compelling reasons to consider such a solution. Typical relational databases are accessed (from a programming POV) using SQL, and are often fairly large installations (significant HD size requirements, multiple process to manage connections to the database, tools for administering the databse, etc.). While relational databases excel when the requirements include such things as the ability to make fast queries on large datasets, or the ability to manage massive volumes of information, they don't offer much for our purposes other than the ability to replicate across servers. For our needs, the installation overhead of a relational database and the added complexity for the developer seems to be a poor fit. Our state data is a simple set of keyed value, which is added to and removed over time. The State Replicator is pushing transactional updates to all standby listeners in real-time, so when the data store is needed (for late joiners), it's needed in its entirety. The query engine doesn't appear to be a benefit. </p>
<h5><a name="StateReplicatorPersistenceOptions-NonRelationalalternatives"></a>Non-Relational alternatives</h5>
<p>There is an ever growing field of non-relational data storage solutions. These include Object Oriented databases, document-oriented database, graph-oriented, and others. Some that we have looked at:</p>
<ul>
        <li>CouchDB<br/>
License: Apache 2.0 <br/>
API: RESTful HTML interface, plugins for JavaScript/PHP/Ruby/Python/Erlang. <br/>
Accessible from C++ using cURLpp (MIT License), a C++ wrapper for libcURL (MIT License)</li>
</ul>
<ul>
        <li>MongoDB<br/>
License: GNU AGPL v3.0.<br/>
API: We could enumerate all the cool features of MongoDB, such as it's C++, C#, Java, Erlan, Python APIs, it's cool binary JSON-like serialization format, and so forth... but it's license is just not something we're happy about. </li>
</ul>
<ul>
        <li>Voldemort<br/>
License: Apache 2.0 <br/>
API: Relatively new project, lacking in documentation. Written in Java, and there is a C++ client demo that only runs on Linux. <br/>
Provides automatic replication. </li>
</ul>
</div>
<div id="commentsSection" class="wiki-content pageSection">
<div style="float: right;">
<a href="https://wiki.asterisk.org/wiki/users/viewnotifications.action" class="grey">Change Notification Preferences</a>
</div>
<a href="https://wiki.asterisk.org/wiki/display/TOP/State+Replicator+Persistence+Options">View Online</a>
|
<a href="https://wiki.asterisk.org/wiki/pages/diffpagesbyversion.action?pageId=12550532&revisedVersion=24&originalVersion=23">View Changes</a>
|
<a href="https://wiki.asterisk.org/wiki/display/TOP/State+Replicator+Persistence+Options?showComments=true&showCommentArea=true#addcomment">Add Comment</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>