Parallelism

Clio supports multiple protocols and backends for parallelism, distributed computing and RPC. These can be configured in the clio.toml file. Current version of Clio supports web workers, worker threads and web socket backends. Future versions will add TCP, UDP, UNIX sockets and Windows named pipe support.

Servers

To specify the type of servers you want, you can use [[servers]] in your clio.toml file. Below you will see all available options for different backends:

Web Workers
Worker Thread
Web Socket
Web Workers
[[servers]]
proto = "ww"
name = "default"
Worker Thread
[[servers]]
proto = "wt"
name = "default"
Web Socket
[[servers]]
proto = "ws"
port = 1337
host = "0.0.0.0"
name = "default"

Workers

Workers host instances of your functions for parallel or distributed execution:

Web Workers
Worker Thread
Web Socket
Web Workers
[[workers]]
proto = "ww"
count = "cpu" # or a number
server = "default"
Worker Thread
[[workers]]
proto = "wt"
count = "cpu" # or a number
server = "default"
Web Socket
[[workers]]
proto = "ws"
url = "ws://localhost:1337"
count = "cpu" # or a number
server = "default"

Executor

Each project can have one executor. Executor runs your main function and handles all parallel function calls for you:

Web Workers
Worker Thread
Web Socket
Web Workers
[executor]
proto = "ww"
wait_for = "cpu" # or a number
server = "default"
Worker Thread
[executor]
proto = "wt"
wait_for = "cpu" # or a number
server = "default"
Web Socket
[executor]
proto = "ws"
url = "ws://localhost:1337"
wait_for = "cpu"
server = "default"

In above config files, wait_for is used to wait for n workers to connect before running your main function.