Skip to content

Mostly-transparent batching of remote messages in Erlang/Elixir cluster

License

Notifications You must be signed in to change notification settings

skirino/batched_communication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BatchedCommunication

Mostly-transparent batching of remote messages in Erlang/Elixir cluster.

Hex.pm Coverage Status

Features & Design

For high throughput use cases ErlangVM's default remote messaging may not be optimal. Messages that are not sensitive to latency can be sent in compressed batches to save network bandwidth and to reduce TCP overhead.

  • BatchedCommunication.cast/2, BatchedCommunication.call/3, etc. (which behave similarly to GenServer.cast/2, GenServer.call/3, etc.) are provided.

  • Remote messages sent using BatchedCommunication are relayed to the following processes:

    • A BatchedCommunication.Sender process on the sender node, which buffers messages for a while, (optionally) compresses it, and sends the batch to the Receiver process on the destination node.
    • A BatchedCommunication.Receiver process on the receiver node, which decodes the received batch and dispatches messages to each destination process.
  • There are 32 Senders and 32 Receivers in each node (for concurrency within each node) and the actual Sender and Receiver processes are chosen by hash values of receiver node and sender node, respectively. Thus message passing using BatchedCommunication preserves order of messages between each pair of processes (just as the original Erlang message passing does), since messages go through the same set of Sender and Receiver processes.

  • The following configuration parameters can be modified at runtime:

    • maximum wait time before sending messages as a batch
    • maximum number of accumulated messages (during wait time) in a batch
    • whether to compress batched messages or not
  • Of course local messages (i.e., message sent within a single node) are delivered immediately, bypassing the batching mechanism described above.

About

Mostly-transparent batching of remote messages in Erlang/Elixir cluster

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages