Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement transients directory quota allocation + automatic GC #65

Open
raulk opened this issue Jul 13, 2021 · 3 comments
Open

implement transients directory quota allocation + automatic GC #65

raulk opened this issue Jul 13, 2021 · 3 comments
Milestone

Comments

@raulk
Copy link
Member

raulk commented Jul 13, 2021

Add a configuration option that enables users to limit the growth of the transients directory, along with a watermark at which transients will be reclaimed by internally calling GC.

type Config struct {
    ...
    TransientsQuota        uint64   // in bytes; GC active if non-zero
    TransientsGCWatermark  float64  // in percent; GC active if non-zero
}

GC triggering

GC will be triggered proactively on watermark breach.

But for more robustness, we should also trigger GC when an upgraded mount needs to download a transient whose size would make the transient directory exceed its allocated quota. This is the reactive path.

This path can be implemented by passing in a gater function to the upgrader, which the upgrader calls with the size of the mount, to get clearance to download that mount, and check out a reservation token.

  • When the mount is downloaded, it returns the token to the gater in success, which lets the gater know that the reserved space has been truly used.
  • If the mount fails to download, it returns the token in error, which informs the gater that the reserved space can be reallocated.

This pattern enables many concurrent mounts to compete for and share available space through a system of temporary reservation.

@raulk raulk changed the title implement transients directory quota allocation implement transients directory quota allocation + automatic GC Jul 13, 2021
@raulk raulk added this to the future milestone Jul 13, 2021
@raulk
Copy link
Member Author

raulk commented Jul 13, 2021

FYI @dirkmc @aarshkshah1992. This is the way I envision this working.

@aarshkshah1992
Copy link
Contributor

@raulk Can we implement a GC based on LRU/LFU ? We can then re-use the DAGStore as a fixed size persistent cache of CAR files on Saturn/Retrieval Market L2 nodes. The requirement there is that home users will pre-allocate a fixed amount of space that we can use to persist CAR files which will then be served onwards to other CDN peers. The CAR files will be fetched using an "IPFSGatewayMount".

@raulk
Copy link
Member Author

raulk commented Jun 7, 2022

@aarshkshah1992 Yes, we can. Acquisitions and releases would need to notify the GC policy accordingly so it can internally track last access or access count. The key here will be to define a clean interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants