-
Notifications
You must be signed in to change notification settings - Fork 42
Description
Context
Some dapps frequently add and remove data from their flash drives. Over time, an active dapp using an on-disk database may consume increasing amounts of drive space on the host without reclaiming free space. This adds unnecessary storage costs for node runners validating the dapp.
This problem can be remediated using thin provisioning. With a proper solution, we could allow machines to start with 1TB of preallocated disk space where the actual used space on the host remains minimal, by leveraging sparse files. The hash tree would remain fast by avoiding pristine data access.
Possible Solutions
The solution requires:
- Guest kernel patch: Add support for requesting the host emulator to discard unused disk space (using HTIF device)
- Guest filesystem: Mount guest ext4 flash drives with the
discardoption - Host HTIF device: Handle HTIF request and use hole punching to reclaim space on the host
- Hash tree optimization: Ensure the hash tree avoids touching pristine data in memory ranges (e.g., when preallocating a 1TB flash drive)
We should also consider extending this approach to RAM. For machines with 1TB of RAM booted with init_on_alloc=1 init_on_free=1, which zeros allocated/deallocated pages when starting/terminating Linux processes, so we could potentially reclaim space from pristine pages in physical memory as well.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status