DCP Worker memory experiment: Linux x64

Docker image · x86_64 Linux · for invited testers

Experimental, not a release. This is the official distributivenetwork/dcp-worker:8.0.1-amd64 image with three parts replaced from draft feature branches: an evaluator that measures each sandbox's memory, a sandbox that reports each slice's peak RAM and GPU memory, and a worker that schedules slices against a memory budget. Use a separate volume, as below, so it never touches a production worker's identity.

Download
SHA-256 checksum

72bd950946054cf658a2ee6cd8554f6229f29cd352166f9686a334696d9c45c2  dcp-worker-8.0.1-memory-experiment-amd64.tar.gz

1 Load the image

sha256sum dcp-worker-8.0.1-memory-experiment-amd64.tar.gz && \
docker load -i dcp-worker-8.0.1-memory-experiment-amd64.tar.gz

The image is tagged dcp-worker:8.0.1-memory-experiment-amd64.

2 Register (once)

Create a registration key at dcp.cloud/keys, then:

docker volume create dcp-worker-memx && \
docker run --rm -v dcp-worker-memx:/opt/dcp/.dcp dcp-worker:8.0.1-memory-experiment-amd64 \
  --register=0xYOUR_REGISTRATION_KEY && \
sleep 65

A new registration takes up to a minute to reach the worker, hence the wait.

3 Run

docker run -d --name dcp-worker-memx --memory=8g \
  -p 127.0.0.1:9080:9080 \
  -v dcp-worker-memx:/opt/dcp/.dcp dcp-worker:8.0.1-memory-experiment-amd64 \
  --no-global --management-hostname=0.0.0.0

4 Watch the memory figures

After the worker has run a few slices:

curl -s http://127.0.0.1:9080/worker/task-info | sed 's/^window.taskInfo=//' \
  | jq '.workerProcess | {rss, heapLimit, budget: .budget | {limit, reserve, committed}}'

Per job, what the worker has learned (slice count, mean, largest and the estimate it schedules with, apart for fresh and reused sandboxes):

curl -s http://127.0.0.1:9080/worker/task-info | sed 's/^window.taskInfo=//' \
  | jq '.workerProcess.budget.jobs, .workerProcess.sandboxReuse'

All figures are bytes. The whole object is jq . without the filter.

5 Change the budget

The image's settings are in /etc/dcp/dcp-worker/dcp-config.js. To change them, save this as dcp-config.js, edit it, and add -v "$PWD/dcp-config.js:/etc/dcp/dcp-worker/dcp-config.js:ro" to the run command:

{
  worker: {
    memory: {
      budget: 0.5,       /* fraction of the memory limit, or a number of bytes */
      statsFile: '/opt/dcp/.dcp/memory-peaks.json',
      probeWait: 60,     /* seconds a new job's first slice runs alone */
    },
  },
}

Measured peaks are kept in memory-peaks.json in the volume, so a restarted worker remembers the jobs it has seen.

6 Stop and remove

docker logs --tail 50 dcp-worker-memx
docker stop -t 300 dcp-worker-memx && docker rm dcp-worker-memx

Keep the dcp-worker-memx volume to reuse the same registered worker; remove it with docker volume rm dcp-worker-memx when done.