All Projects → Asmod4n → Mruby Actor

Asmod4n / Mruby Actor

Licence: apache-2.0
A actor library for distributed mruby

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Mruby Actor

theater
Actor framework for Dart. This package makes it easier to work with isolates, create clusters of isolates.
Stars: ✭ 29 (+163.64%)
Mutual labels:  actors, actor-model, thread
Sobjectizer
An implementation of Actor, Publish-Subscribe, and CSP models in one rather small C++ framework. With performance, quality, and stability proved by years in the production.
Stars: ✭ 172 (+1463.64%)
Mutual labels:  thread, actor-model, actors
protoactor-python
Proto Actor - Ultra fast distributed actors
Stars: ✭ 78 (+609.09%)
Mutual labels:  actors, actor-model
ComposableAsync
Create, compose and inject asynchronous behaviors in .Net Framework and .Net Core.
Stars: ✭ 28 (+154.55%)
Mutual labels:  actor-model, thread
protoactor-go
Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin
Stars: ✭ 4,138 (+37518.18%)
Mutual labels:  actors, actor-model
Riker
Easily build efficient, highly concurrent and resilient applications. An Actor Framework for Rust.
Stars: ✭ 745 (+6672.73%)
Mutual labels:  actor-model, actors
wasmcloud-otp
wasmCloud host runtime that leverages Elixir/OTP and Rust to provide simple, secure, distributed application development using the actor model
Stars: ✭ 197 (+1690.91%)
Mutual labels:  actors, actor-model
nact
nact ⇒ node.js + actors ⇒ your services have never been so µ
Stars: ✭ 1,003 (+9018.18%)
Mutual labels:  actors, actor-model
Thespian
Python Actor concurrency library
Stars: ✭ 220 (+1900%)
Mutual labels:  actor-model, actors
transit
Massively real-time city transit streaming application
Stars: ✭ 20 (+81.82%)
Mutual labels:  actors, actor-model
gen browser
Transparent bi-directional communication for clients, servers and more
Stars: ✭ 67 (+509.09%)
Mutual labels:  actors, actor-model
reacted
Actor based reactive java framework for microservices in local and distributed environment
Stars: ✭ 17 (+54.55%)
Mutual labels:  actors, actor-model
Coerce Rs
Coerce - an asynchronous (async/await) Actor runtime and cluster framework for Rust
Stars: ✭ 231 (+2000%)
Mutual labels:  actor-model, actors
Actors.jl
Concurrent computing in Julia based on the Actor Model
Stars: ✭ 95 (+763.64%)
Mutual labels:  actors, actor-model
Actor Framework
An Open Source Implementation of the Actor Model in C++
Stars: ✭ 2,637 (+23872.73%)
Mutual labels:  actor-model, actors
xoom-cluster
The VLINGO XOOM platform SDK cluster management for Reactive, scalable resiliency of JVM tools and applications running on XOOM LATTICE and XOOM ACTORS.
Stars: ✭ 25 (+127.27%)
Mutual labels:  actors, actor-model
Vlingo Actors
The VLINGO/PLATFORM type-safe Actor Model toolkit for reactive concurrency and resiliency using Java and other JVM languages.
Stars: ✭ 196 (+1681.82%)
Mutual labels:  actor-model, actors
Gosiris
An actor framework for Go
Stars: ✭ 222 (+1918.18%)
Mutual labels:  actor-model, actors
Protoactor Go
Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin
Stars: ✭ 3,934 (+35663.64%)
Mutual labels:  actor-model, actors
Calvin Base
Calvin is an application environment that lets things talk to things, among other things.
Stars: ✭ 282 (+2463.64%)
Mutual labels:  actor-model, actors

mruby-actor

Breaking changes

The wire protocol is incompatible with earlier versions, its all msgpack now and is as such compatible to any programming language which has msgpack and zeromq support. Discovery lends its idea from zyre, but uses a different wire protocol and only runs over multicast. Each actor now runs in its own zmq context, this was needed so a clean shutdown is possible. The old mruby-actor had to be forced killed to close itself.

Preliminary

mruby-actor is a library to bring distributed concurrency to mruby with the actor model. If you just need local threading based on the actor model for mruby take a look at mruby-zmq

Blocking operations

Blocking operations must be avoided at all costs. If you really need to block a mrb context do so in a ZMQ::Thread. If you block a mruby-actor for longer than 15 seconds its considered to have crashed by other actors.

Security

All communication between mruby actors is authenticated and encrypted, except the Service Discovery, its going to be fully authenticated in another released.

Each Actor expects a Auth class and optionally Arguments for it, the args must be a Array. Take a look at https://github.com/Asmod4n/mruby-zmq/blob/a56c5722902a079777c28de67ad2aca8f499095a/mrblib/zap.rb#L54 how to implement it for your needs. The mechanism used in mruby-actor is curve. The authentication protocol used is https://rfc.zeromq.org/spec:27/ZAP/

Blocks, Procs, lambdas

mruby-actor makes use of mrubys possibility to serialize and deserialize blocks of ruby code. Those blocks work a bit differently than you are used to: they have no way to capture the environment around them. How it works: if you pass a code block it gets serialized, send over the network to the remote actor, gets deserialized and executed there. Yes, that is literary remote code execution; to build a safeguard around it mruby-actor got completely rewritten to authenticate every peer which wants to connect. Also, this gem won't be turned into a mgem until mruby 1.3 is released, there are still some issues which have to be addressed: https://github.com/mruby/mruby/issues/created_by/clayton-shopify

Examples

keypair = LibZMQ.curve_keypair
keypair2 = LibZMQ.curve_keypair
actor = Actor.new(auth: {class: ZMQ::Zap::Authenticator}, server_endpoint: "tcp://en0:*", keypair: keypair)
actor2 = Actor.new(auth: {class: ZMQ::Zap::Authenticator}, keypair: keypair2)
actor3 = Actor.new(auth: {class: ZMQ::Zap::Authenticator, args: ["hallo", "actor"]})
actor4 = Actor.new(auth: {class: ZMQ::Zap::Authenticator})
# if you are on Windows, the mandatory options besides tha auth hash is :server_endpoint and :broadcast_address, the server endpoint must be something that works locally and from other hosts it wants to interact with, the broadcast address must be the broadcast address of the server endpoint. On other platforms it automatically picks the first running network interface with a broadcast address it can find and binds to a random port.
# Take a look at http://api.zeromq.org/master:zmq-bind which endpoints are available in zmq, wildcard tcp ports are supported.
# the inproc transport isn't supported by design, each actor runs in a seperate zmq context, inproc sockets can only communicate in their own zmq context.
sleep 1 # requires conf.gem mgem: 'mruby-sleep' in your build_config.rb
string = actor.remote_new(actor.peers.first.first, String, "hallo")
string.async(:upcase!)
string.send(:to_str)
string.to_str
string.async(:each_byte) {|byte|puts byte.chr} # create a actor in another terminal to see this codes gets executed on the remote actor

License

Copyright 2015,2017 Hendrik Beskow

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project 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.

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].