Skip to content
Query.Farm
Talk with Us

Run and deploy a C# worker

Use one entry point for local subprocess and pooled launcher operation:

await worker.RunFromArgsAsync(args);

RunFromArgsAsync selects stdio by default and AF_UNIX when the VGI launcher supplies its socket arguments. Those are the two worker transports shipped in QueryFarm.Vgi 0.3.0.

dotnet publish --configuration Release --runtime linux-x64 --self-contained true
# use linux-arm64 for Graviton/ARM64

Attach the resulting executable with launch::

ATTACH 'launch:/srv/demo/demo-worker' AS demo (TYPE vgi);

launch: amortizes CLR startup and JIT across queries and lets DuckDB open concurrent connections to the same Unix socket. A bare executable location uses stdio and may start a new process for each pool slot or query.

No HTTP server in the C# worker SDK yet

The generic RPC stack has HTTP/client capabilities, but QueryFarm.Vgi.Worker currently exposes only stdio and Unix sockets. Do not copy Python, Go, TypeScript, or Java HTTP deployment instructions into a C# worker deployment.

  • Reserve stdout for the protocol; log to stderr or the in-band call context.
  • Treat a worker as concurrent. Function registrations are shared; producer/processor objects are per invocation.
  • Bound memory by emitting batches and using durable buffering state.
  • Publish for the target architecture and smoke-test the exact published executable.
  • Use cancellation tokens when hosting RunStdioAsync or RunUnixSocketAsync yourself.