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.
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:
[[servers]]proto = "ww"name = "default"
[[servers]]proto = "wt"name = "default"
[[servers]]proto = "ws"port = 1337host = "0.0.0.0"name = "default"
Workers host instances of your functions for parallel or distributed execution:
[[workers]]proto = "ww"count = "cpu" # or a numberserver = "default"
[[workers]]proto = "wt"count = "cpu" # or a numberserver = "default"
[[workers]]proto = "ws"url = "ws://localhost:1337"count = "cpu" # or a numberserver = "default"
Each project can have one executor. Executor runs your main function and handles all parallel function calls for you:
[executor]proto = "ww"wait_for = "cpu" # or a numberserver = "default"
[executor]proto = "wt"wait_for = "cpu" # or a numberserver = "default"
[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.