cbi icon indicating copy to clipboard operation
cbi copied to clipboard

Caching (question / enhancement)

Open cwbeitel opened this issue 7 years ago • 5 comments

This is awesome.

Can you explain how build and image pull caching can work with cbi? How can I configure one or more of the build tools, e.g. docker, to either cache previous builds or previous image pulls?

Related to https://github.com/kubeflow/kubeflow/issues/289#issuecomment-377827101

cwbeitel avatar Apr 02 '18 17:04 cwbeitel

Thanks for your interest in CBI!

Can you explain how build and image pull caching can work with cbi? How can I configure one or more of the build tools, e.g. docker, to either cache previous builds or previous image pulls?

This is plugin-specific.

Docker plugin

Docker plugin connects to a random Docker daemon that is running on a Kubernetes node, via a bind-mounted /var/run/docker.sock.

The less number of nodes, the higher probability to hit the cache. (and higher load on the each of the nods)

I think we should also extend Docker plugin pod template to support setting NodeSelector, so as to limit the Docker node to be used.

BuildKit plugin

BuildKit plugins connects to a BuildKit service running on the Kubernetes cluster.

The less number of BuildKit replicas, the higher probability to hit the cache.

BuildKit also plans to implement cache-aware load-balancing mode: https://github.com/moby/buildkit/issues/62

Buildah plugin

Buildah plugin creates an one-shot buildah container.

Buildah does not seem to support instruction cache, AFAIK. Probably, future version of Buildah plugin would support caching, as in the case of img plugin (below).

img plugin (Not implemented yet)

img plugin would creates an one-shot kubectl exec some-stateful-img-pod img .... container.

The less number of img pods, the higher probability to hit the cache.

GCB plugin (Not implemented yet)

Needs investigation. ( https://cloud.google.com/container-builder/docs/speeding-up-builds?hl=en#caching_directories_with_google_cloud_storage )

AkihiroSuda avatar Apr 03 '18 10:04 AkihiroSuda

Great summary, thanks for the info!

cwbeitel avatar Apr 04 '18 15:04 cwbeitel

Thanks @AkihiroSuda for your great work.

BuildKit plugin

BuildKit plugins connects to a BuildKit service running on the Kubernetes cluster.

The less number of BuildKit replicas, the higher probability to hit the cache.

BuildKit also plans to implement cache-aware load-balancing mode: moby/buildkit#62

I'm studying how to use the buildkit to build image with cache, and find "cache-aware load-balancing mode" would be a great feature. Do we have plan when to release it? Also, for this Distributed build mode, could you provide more detail docs?

lugeng avatar Feb 12 '19 02:02 lugeng

It is still under discussion and would still take months for implementation

AkihiroSuda avatar Feb 12 '19 02:02 AkihiroSuda

OK, thanks~

lugeng avatar Feb 12 '19 02:02 lugeng