[FEATURE] Support concurrency limits when setting up layers
Kern-- opened this issue · 0 comments
Description
When pulling an image with Docker, Nerdctl, or Kubernetes, there is a per-image concurrency limiter which limits the number of inflight layer pulls.
When SOCI handles a layer, it unconditionally spawns a goroutine to handle all adjacent layers:
Lines 427 to 447 in 21ec544
For images with a large number of layers or a large number of concurrent image pulls, the SOCI snapshotter has no limit to the number of layers it will try to resolve. This could put pressure on the network, but more likely would put pressure on the metadata bboltdb and could cause pull times to grow indefinitely.
Describe the solution you'd like
There should be an option to limit the number of in-flight resolutions. It is an open question whether this should be a global limit or a per-image limit.
Describe any alternative solutions/features you've considered
No response
Any additional context or information about the feature request
An additional question is whether there is a race where if we're slow to set up an adjacent layer, can we end up resolving it again when handling the next layer?