All Projects → erleans → Erleans

erleans / Erleans

Licence: apache-2.0
Erlang Orleans

Programming Languages

erlang
1774 projects

Projects that are alternatives of or similar to Erleans

Ray
项目停止更新,新项目:https://github.com/RayTale/Vertex
Stars: ✭ 635 (+165.69%)
Mutual labels:  orleans, distributed-systems
road-to-orleans
This repository illustrates the road to orleans with practical, real-life examples. From most basic, to more advanced techniques.
Stars: ✭ 55 (-76.99%)
Mutual labels:  distributed-systems, orleans
Orleans.clustering.kubernetes
Orleans Membership provider for Kubernetes
Stars: ✭ 140 (-41.42%)
Mutual labels:  orleans, distributed-systems
Minecase
Minecraft server based on Orleans
Stars: ✭ 581 (+143.1%)
Mutual labels:  orleans, distributed-systems
Orleans
Orleans is a cross-platform framework for building distributed applications with .NET
Stars: ✭ 8,131 (+3302.09%)
Mutual labels:  orleans, distributed-systems
Microdot
Microdot: An open source .NET microservices framework
Stars: ✭ 1,222 (+411.3%)
Mutual labels:  orleans, distributed-systems
Fluentdispatch
🌊 .NET Standard 2.1 framework which makes easy to scaffold distributed systems and dispatch incoming load into units of work in a deterministic way.
Stars: ✭ 152 (-36.4%)
Mutual labels:  orleans, distributed-systems
Testground
🧪 A platform for testing, benchmarking, and simulating distributed and p2p systems at scale.
Stars: ✭ 216 (-9.62%)
Mutual labels:  distributed-systems
Zebus
A lightweight Peer to Peer Service Bus
Stars: ✭ 222 (-7.11%)
Mutual labels:  distributed-systems
Awesome Parallel Computing
A curated list of awesome parallel computing resources
Stars: ✭ 212 (-11.3%)
Mutual labels:  distributed-systems
Swellrt
SwellRT main project. Server, JavaScript and Java clients
Stars: ✭ 205 (-14.23%)
Mutual labels:  distributed-systems
Crdt Playground
Stars: ✭ 215 (-10.04%)
Mutual labels:  distributed-systems
Materialize
Materialize lets you ask questions of your live data, which it answers and then maintains for you as your data continue to change. The moment you need a refreshed answer, you can get it in milliseconds. Materialize is designed to help you interactively explore your streaming data, perform data warehousing analytics against live relational data, or just increase the freshness and reduce the load of your dashboard and monitoring tasks.
Stars: ✭ 3,341 (+1297.91%)
Mutual labels:  distributed-systems
Dbtester
Distributed database benchmark tester
Stars: ✭ 214 (-10.46%)
Mutual labels:  distributed-systems
Mgmt
Next generation distributed, event-driven, parallel config management!
Stars: ✭ 2,708 (+1033.05%)
Mutual labels:  distributed-systems
Tifs
A distributed POSIX filesystem based on TiKV, with partition tolerance and strict consistency.
Stars: ✭ 209 (-12.55%)
Mutual labels:  distributed-systems
Templates
.NET project templates with batteries included, providing the minimum amount of code required to get you going faster.
Stars: ✭ 2,864 (+1098.33%)
Mutual labels:  orleans
Lagom
Reactive Microservices for the JVM
Stars: ✭ 2,590 (+983.68%)
Mutual labels:  distributed-systems
Gosiris
An actor framework for Go
Stars: ✭ 222 (-7.11%)
Mutual labels:  distributed-systems
Detective
🔎 A distributed application health monitoring library
Stars: ✭ 221 (-7.53%)
Mutual labels:  distributed-systems

Erleans

CircleCIcodecov

Erleans is a framework for building distributed applications in Erlang and Elixir based on Microsoft Orleans.

Requirements

Rebar3 3.13.0 or above or Elixir 1.9+. Easiest way to get the latest Rebar3:

$ rebar3 local upgrade
...
$ export PATH=~/.cache/rebar3/bin:$PATH

Components

Grains

Stateful grains are backed by persistent storage and referenced by a primary key set by the grain. An activation of a grain is a single Erlang process in on an Erlang node (silo) in an Erlang cluster. Activation placement is handled by Erleans and communication is over standard Erlang distribution. If a grain is sent a message and does not have a current activation one is spawned.

Grain state is persisted through a database provider with an always increasing change id or etag. If the change id or etag has been by another activation the activation attempting to save state will stop.

Activations are registered through lasp_pg.

Stateless Grains

Stateless grains have no restriction on the number of activations and do not persist state to a database.

Stateless grain activations are pooled through sbroker while being counted by a gproc resource counter. This allows for the use of sbroker to select an activation if available and to create a new activation if none were available immediately and the number currently activated is less than the max allowed.

Reminders (TODO)

Timers that are associated with a grain, meaning if a grain is not active but a reminder for that grain ticks the grain is activated at that time and the reminder is delivered.

Observers (TODO)

Processes can subscribe to grains to receive notifications for grain specific events. If a grain supports observers a group is created through lasp_pg that observers are added to and to which notifications are sent.

Providers

Interface that must be implemented for any persistent store to be used for grains.

Streams have a provider type as well for providing a pluggable stream layer.

Differences from gen_server

No starting or linking, a grain is activated when it is sent a request if an activation is not currently running.

Grain Placement

  • prefer_local: If an activation does not exist this causes the new activation to be on the same node making the request.
  • random: Picks a random node to create any new activation of a grain.
  • stateless: Stateless grains are always local. If no local activation to the request exists one is created up to a default maximum value.
  • {stateless, Max :: integer()}: Allows for up to Max number of activations for a grain to exist per node. A new activation, up until Max exist on the node, will be created for a request if an existing activation is not currently busy.

Erlang Example

The grain implementation test_grain is found in test/:

-module(test_grain).

-behaviour(erleans_grain).

...

placement() ->
    prefer_local.

provider() ->
    in_memory.

deactivated_counter(Ref) ->
    erleans_grain:call(Ref, deactivated_counter).

activated_counter(Ref) ->
    erleans_grain:call(Ref, activated_counter).

node(Ref) ->
    erleans_grain:call(Ref, node).

state(_) ->
    #{activated_counter => 0,
      deactivated_counter => 0}.

activate(_, State=#{activated_counter := Counter}) ->
    {ok, State#{activated_counter => Counter+1}, #{}}.
$ rebar3 as test shell
...
> Grain1 = erleans:get_grain(test_grain, <<"grain1">>).
> test_grain:activated_counter(Grain1).
{ok, 1}

Elixir Example

defmodule ErleansElixirExample do
  use Erleans.Grain,
    placement: :prefer_local,
    provider: :postgres,
    state: %{:counter => 0}

  def get(ref) do
    :erleans_grain.call(ref, :get)
  end

  def increment(ref) do
    :erleans_grain.cast(ref, :increment)
  end

  def handle_call(:get, from, state = %{:counter => counter}) do
    {:ok, state, [{:reply, from, counter}]}
  end

  def handle_cast(:increment, state = %{:counter => counter}) do
    new_state = %{state | :counter => counter + 1}
    {:ok, new_state, [:save_state]}
  end
end
$ mix deps.get
$ mix compile
$ iex --sname a@localhost -S mix

iex(a@localhost)1> ref = Erleans.get_grain(ErleansElixirExample, "somename")
...
iex(a@localhost)2> ErleansElixirExample.get(ref)
0
iex(a@localhost)3> ErleansElixirExample.increment(ref)
:ok
iex(a@localhost)4> ErleansElixirExample.get(ref)
1

Failure Semantics

Contributing

Running Tests

Because the tests rely on certain configurations of apps it is easiest to run the tests with the alias test:

$ epmd -daemon
$ rebar3 test

Note that the distributed tests will only work on a node with hostname fanon. This will be easily avoidable in the next release of OTP but until need to figure out another work around. Running rebar3 ci will run all the tests but dist tests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].