RemoteExec is a distributed computing platform that allows you to execute C# methods remotely across multiple servers using SignalR.
It enables seamless execution of static C# methods across multiple remote servers, featuring automatic load balancing, failover, real-time metrics and API key authentication.
RemoteExec aims to make it easy to scale compute workloads or distribute jobs, no cloud lock-in and no complex configuration.
Possible use cases include:
- Parallel scientific/data computing
- Scaling out microservices and custom workflows
- Running distributed jobs in CI/CD pipelines
-
Add the RemoteExec client library to your C# project:
- NuGet:
dotnet add package RemoteExec.Client
- NuGet:
-
Connect to your RemoteExec server(s) and execute code:
using RemoteExec.Client; // Configure the executor with your server URL(s) and API Key var executor = new RemoteExecutor("http://localhost:8080", opts => { opts.ApiKey = "your-key"; }); await executor.StartAsync(); // Execute any static method remotely! int result = await executor.ExecuteAsync(Add, 2, 3); Console.WriteLine(result); // 5 static int Add(int a, int b) => a + b;
-
Download & install the latest release:
- Docker:
docker pull stonered/remoteexec-server
- Docker:
-
Run the server
- Using the included Docker Compose (recommended from the
src/RemoteExec.Serverfolder):
docker compose -f docker-compose.yml upSee src/RemoteExec.Server/docker-compose.yml for details.
- Direct Docker run (alternative):
docker run -p 8080:80 \
-e ASPNETCORE_ENVIRONMENT=Production \
-v $(pwd)/appsettings.docker.json:/appsettings.json:ro \
--name remoteexec-server stonered/remoteexec-server:latestConfiguration and API keys are controlled via appsettings.json (see src/RemoteExec.Server/appsettings.json). To run with Docker Compose, copy and edit the example below into src/RemoteExec.Server/appsettings.docker.json and add your API keys.
See /src/RemoteExec/Program.cs
using CuteUtils.FluentMath.TypeExtensions;
using RemoteExec.Client;
// Configure the RemoteExecutor to connect to a single server
RemoteExecutor singleHostExecutor = new RemoteExecutor("https://localhost:5001/remote", configure =>
{
configure.ApiKey = "dev-api-key-1";
});
await singleHostExecutor.StartAsync();
// Execute 1000 multiplications in parallel on the remote server
await Parallel.ForAsync(0, 1000, async (i, cancellationToken) =>
{
int r = await singleHostExecutor.ExecuteAsync(Multiply, i, i + 1, cancellationToken);
Console.WriteLine($"Multiply {i} * {i + 1} = {r}");
});
await singleHostExecutor.StopAsync();
static async Task<int> Multiply(int x, int y)
{
await Task.Delay(Random.Shared.Next(100, 500));
return x.Multiply(y);
}