<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<div class="moz-cite-prefix">I added cloudi_crdt for internal
(Erlang/Elxiir/etc.) CloudI services to have an in-memory
distributed KV database. It uses a POLog CRDT with the data
stored in an Erlang map locally (reads are accessing the local
Erlang map). There is additional functionality (bootstrap and
clean_vclocks) to ensure fault-tolerance problems are handled
(e.g., service processes crashing, netsplits, etc.).<br>
<br>
The configuration does need to know the number of nodes that will
be used, though a node can be replaced without problems. The
amount of messaging with a POLog means that your node count is
best kept lower unless you have fast hardware (so use 4 nodes and
think twice before trying 64 nodes). There is basic use in
cloudi_service_request_rate and more complex use in
cloudi_service_funnel. The cloudi_service_request_rate service
does a loadtest of the CloudI service request throughput that is
sustained without any timeouts. The cloudi_service_funnel service
is able to group multiple service requests into a single service
request as a proxy, so it could be used for a distributed
fault-tolerant cron setup (with cloudi_service_cron). The
relevant links are below:<br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/CloudI/CloudI/blob/develop/src/lib/cloudi_core/src/cloudi_crdt.erl">https://github.com/CloudI/CloudI/blob/develop/src/lib/cloudi_core/src/cloudi_crdt.erl</a><br>
<a class="moz-txt-link-freetext" href="https://github.com/CloudI/CloudI/blob/develop/src/lib/cloudi_service_request_rate/src/cloudi_service_request_rate.erl">https://github.com/CloudI/CloudI/blob/develop/src/lib/cloudi_service_request_rate/src/cloudi_service_request_rate.erl</a><br>
<a class="moz-txt-link-freetext" href="https://github.com/CloudI/CloudI/blob/develop/src/lib/cloudi_service_funnel/src/cloudi_service_funnel.erl">https://github.com/CloudI/CloudI/blob/develop/src/lib/cloudi_service_funnel/src/cloudi_service_funnel.erl</a><br>
<br>
Best Regards,<br>
Michael<br>
<br>
On 12/21/21 5:57 AM, Roberto Ostinelli wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFXp3LLDv28us-Op7S=8h0M=+PY6coGW_22fS=4z23P4tFiTuw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
<div dir="ltr">Let’s write a database! Well not really, but I
think it’s a little sad that there doesn’t seem to be a simple
in-memory distributed KV database in Erlang. Many times all I
need is a consistent distributed ETS table.<br>
<br>
The two main ones I normally consider are:<br>
<br>
<ul>
<li><b>Riak</b> which is great, it handles loads of data and
is based on DHTs. This means that when there are cluster
changes there is a need for redistribution of data and the
process needs to be properly managed, with handoffs and so
on. It is really great but it’s eventually consistent and on
many occasions it may be overkill when all I’m looking for
is a simple in-memory ACI(not D) KV solution which can have
100% of its data replicated on every node.</li>
<li><b>mnesia</b> which could be it, but unfortunately
requires special attention when initializing tables and
making them distributed (which is tricky), handles net
splits very badly, needs hacks to resolve conflicts, and
does not really support dynamic clusters (additions can be
kind of ok, but for instance you can’t remove nodes unless
you stop the app).</li>
<li>…other solutions? In general people end up using
Foundation DB or REDIS (which has master-slave replication),
so external from the beam. Pity, no?</li>
</ul>
<br>
So… :) Well I don’t plan to write a database (since ETS is <i>awesome</i>),
rather distributing it in a cluster. I’d simply want a
distributed ETS solution after all!<br>
<br>
I’ve already started the work and released a version 0.1.0 or
ram:<br>
<a href="https://github.com/ostinelli/ram"
moz-do-not-send="true">https://github.com/ostinelli/ram</a><br>
<br>
Docs are here:<br>
<a href="https://hexdocs.pm/ram" moz-do-not-send="true">https://hexdocs.pm/ram</a><br>
<br>
Please note this is a very early stage. It started as an
experiment and it might remain one. So feedback is welcome to
decide its future!<br>
<div><br>
</div>
<div>Best,</div>
<div>r.</div>
</div>
</blockquote>
<br>
</body>
</html>