Skip to content

Using tmpfs for faster builds

Since v2.8.2, you can configure RunsOn to automatically create a tmpfs volume, which will then be used to host the following directories:

  • /tmp (overlay)
  • /home/runner (overlay)
  • /var/lib/docker (bind mount)

For now the tmpfs volume is set to use up to 100% of the available memory on the runner, so if the job suddenly fails for an unknown reason, just increase your runner size (highly recommended to use large-memory instance types such as r7* or r8*).

Use cases

Using tmpfs is a good fit for:

  1. Speeding up I/O intensive workflows, since any writes to the directories listed above are done in memory, and are much faster than writing to disk.

Accessing tmpfs

If you include tmpfs in the extras parameter of your workflow job, a tmpfs volume will be created in the /mnt/tmpfs directory, and the directories specified above will automatically be bind-mounted or overlay-mounted into it.

Using tmpfs in your workflow

jobs:
efs:
runs-on: runs-on=${{ github.run_id }}/family=r7/ram=16/extras=tmpfs
steps:
- run: df -ah /mnt/tmpfs
# tmpfs 16G 724K 16G 1% /mnt/tmpfs
- run: df -ah /home/runner
# overlay 16G 724K 16G 1% /home/runner
- run: df -ah /tmp
# overlay 16G 724K 16G 1% /tmp
- run: df -ah /var/lib/docker
# tmpfs 16G 724K 16G 1% /var/lib/docker

Considerations

Again, this is a kind of YOLO mode (but with potentially great rewards), so make sure your are correctly right-sizing your runners.

Limitations

  • extras=tmpfs is only available on Linux runners.