# Independent Runtimes (/daemon/independent-runtimes)



Give each user their own runtime. Each can run multiple jobs with separate credentials and storage.

## Create Runtimes [#create-runtimes]

Start Docker, then give each runtime a unique home, container name, and port:

```bash
MLAB_HOME="$HOME/mlab-runtimes/alice" mlab daemon backend docker \
  --container mlab-alice --port 48001 \
  --cpus 1 --memory-mib 512 --pids-limit 256

MLAB_HOME="$HOME/mlab-runtimes/bob" mlab daemon backend docker \
  --container mlab-bob --port 48002 \
  --cpus 1 --memory-mib 512 --pids-limit 256
```

This starts the daemons, not trades. Both reuse the same image.

## Use a Runtime [#use-a-runtime]

Select Alice's runtime for your current terminal:

```bash
export MLAB_HOME="$HOME/mlab-runtimes/alice"

mlab daemon status
mlab auth status
mlab strategy jobs
mlab daemon events --limit 20
```

Use this same home when authenticating and deploying jobs. Credentials are not copied from other homes.

Stop only Alice's daemon:

```bash
mlab daemon stop
```

Run `unset MLAB_HOME` to return to the default `~/.market-lab` home.

## Adjust Limits [#adjust-limits]

Limits apply to all jobs in the container combined:

| Flag               | Controls                                               |
| ------------------ | ------------------------------------------------------ |
| `--cpus 1`         | One CPU's worth of execution time, not a reserved core |
| `--memory-mib 512` | 512 MiB of memory, with swap disabled                  |
| `--pids-limit 256` | Up to 256 processes and OS threads, not 256 jobs       |

Stop active jobs and managed orders before changing settings:

```bash
MLAB_HOME="$HOME/mlab-runtimes/alice" mlab daemon backend docker \
  --memory-mib 1024
```

Other settings stay unchanged. The container is recreated; its stored data remains.

Check usage:

```bash
docker stats --no-stream mlab-alice mlab-bob
```

These limits do not restrict disk usage or outgoing network access. For setup errors, see [Troubleshooting](/daemon/troubleshooting).
