# Why is retrieving cache so slow?

**URL:** <https://forums.balena.io/t/why-is-retrieving-cache-so-slow/5991>\
**Category:** Product support\
**Created:** [April 12, 2019, 4:45am UTC](https://forums.balena.io/t/why-is-retrieving-cache-so-slow/5991 "2019-04-12T04:45:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cnr](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@cnr](https://forums.balena.io/u/cnr)\
**Post date:** [April 12, 2019, 4:45am UTC](https://forums.balena.io/t/why-is-retrieving-cache-so-slow/5991/1 "2019-04-12T04:45:27Z")

</div>

My builds say they take 16 seconds to deploy, but if you include retrieving the cache it is much slower than that, what causes cache retrieval to be so slow, and what could be done to improve the time?

It is significant because it affects my development speed. Are there any settings I could modify to make it faster?

EDIT: To be more specific, I’m talking about the time period in which I see this message:  
Pulling previous images for caching purposes…

---

<div class="post-metadata">

**Author:** ![dansku](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dansku/32/1183_2.png) [@dansku](https://forums.balena.io/u/dansku)\
**Post date:** [April 12, 2019, 10:40am UTC](https://forums.balena.io/t/why-is-retrieving-cache-so-slow/5991/13 "2019-04-12T10:40:31Z")

</div>

Hey @cnr,

If your image is very big, this will increase the cache retrieval time.  
You can decrease the size of your image or disable caching.

Which method are you using to push the applications? As this may change the way you disable caching.

Cheers

---

<div class="post-metadata">

**Author:** ![dimitrisnl](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dimitrisnl/32/876_2.png) [@dimitrisnl](https://forums.balena.io/u/dimitrisnl)\
**Post date:** [April 12, 2019, 10:55am UTC](https://forums.balena.io/t/why-is-retrieving-cache-so-slow/5991/14 "2019-04-12T10:55:07Z")

</div>

Are you using our CLI to push (balena push, balena deploy) or you are using the git push way?

---

<div class="post-metadata">

**Author:** ![cnr](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@cnr](https://forums.balena.io/u/cnr)\
**Post date:** [April 12, 2019, 5:10pm UTC](https://forums.balena.io/t/why-is-retrieving-cache-so-slow/5991/16 "2019-04-12T17:10:06Z")

</div>

Git push

---

<div class="post-metadata">

**Author:** ![cnr](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@cnr](https://forums.balena.io/u/cnr)\
**Post date:** [April 12, 2019, 5:11pm UTC](https://forums.balena.io/t/why-is-retrieving-cache-so-slow/5991/17 "2019-04-12T17:11:21Z")

</div>

5 Gb

I don’t want to disable caching because building opencv is part of my dockerfile, so it is definitely faster to run with the cache, it’s just slow to retrieve the cache.

---

<div class="post-metadata">

**Author:** ![shaunmulligan](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/shaunmulligan/32/34_2.png) [@shaunmulligan](https://forums.balena.io/u/shaunmulligan)\
**Post date:** [April 16, 2019, 3:49pm UTC](https://forums.balena.io/t/why-is-retrieving-cache-so-slow/5991/19 "2019-04-16T15:49:16Z")

</div>

@cnr I believe the speed of pulling the cache is based on the fact that the image registry is on AWS and the build (assuming you are building for Arm based device ) is happening on the [packet.net ARM build servers](https://www.packet.com/) so the bottle neck is most likely the download/network speed of [packet.net](http://packet.net). You could try force an emulated build using `git push balena master:balena-emulated` which would mean your actual build would happen on AWS in a qemu emulated build rather than on the ARM builder, this would most likely pull the images much much faster because its on AWS purely, but your build for openCV will be probably 10x slower 😕

---

<div class="post-metadata">

**Author:** ![ebradbury](https://avatars.discourse-cdn.com/v4/letter/e/cc9497/32.png) [@ebradbury](https://forums.balena.io/u/ebradbury)\
**Post date:** [August 7, 2020, 6:17pm UTC](https://forums.balena.io/t/why-is-retrieving-cache-so-slow/5991/20 "2020-08-07T18:17:12Z")

</div>

Hey @shaunmulligan,

Could you tell me if build images are cached on AWS for local builds as well? e.g. `balena push <my device IP>`

I’m experiencing intermittent network issues during local builds and was wondering if there was any background network traffic due to caching?

Thanks,  
Elliot

---

<div class="post-metadata">

**Author:** ![dtischler](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dtischler/32/2483_2.png) [@dtischler](https://forums.balena.io/u/dtischler)\
**Post date:** [August 7, 2020, 8:37pm UTC](https://forums.balena.io/t/why-is-retrieving-cache-so-slow/5991/23 "2020-08-07T20:37:00Z")

</div>

Hi Elliot, when running in Local Mode, the containers are built directly on the device, so any caching is from layers already on the device, but no there is no caching coming from AWS. Of course, network connectivity reaching outside of your network is still possible, as an example the need to download a base image from Dockerhub, a private registry, etc. But, the build itself should not be interfacing with AWS, no. Hope that helps clarify, and there is some more info here: [https://www.balena.io/docs/learn/develop/local-mode/](https://www.balena.io/docs/learn/develop/local-mode/)  
Thanks!
