2

When I try to install anything using snap, I found out that the download speed is very slow. As shown in the screenshot, it is about 20 kb/s:

enter image description here

How can I install a snap fast?

singrium
  • 6,880
  • 1
    May be your internet speed is slow by default? If not, try to change The update servers by following this post – singrium Aug 09 '19 at 09:19
  • 4
    We wont be able to answer this. The speed is mostly determined by external factors like your internet connection and the server providing your software. Plus traffic is regulated in China. – Rinzwind Aug 09 '19 at 09:35
  • There's a CDN used for delivering snaps from the store. Perhaps there's an issue between you and the fastly cdn. They have a debug page at http://www.fastly-debug.com/ which can be used to determine speed of connection to the CDN. Note it's JS based, so you'll need to disable ad-blockers to use it. – popey Aug 15 '19 at 13:14

4 Answers4

6

I encountered a same problem. Snap uses Fastly CDN, which means your speed is determined by which Fastly CDN node you get. If you get a nearest one, the speed can be very quick.

You can execute this command to find out which node you got: dig fastly.cdn.snapcraft.io For me, it was 151.101.26.217 and very slow.

So I changed it to 151.101.62.217 in /etc/hosts and the speed improved from 10k/s to 1M/s. I installed pycharm in 5 minutes.

How to set hosts? Just add a new line in your /etc/hosts:

151.101.62.217  fastly.cdn.snapcraft.io
Eliah Kagan
  • 117,780
  • I've noticed that this approach no longer works for somebody. That's because Snap doesn't always use Fastly CDN now. They are using canonical CDN canonical-bos01.cdn.snapcraft.io. – Genghis Yang Jul 31 '21 at 14:49
  • Because canonical-bos01.cdn.snapcraft.io has only 2 valid IP addresses(both of them are very slow in China), So we cannot change to a faster IP address. This approach is outdated. – Genghis Yang Jul 31 '21 at 14:56
2

Add the following config to your /etc/hosts:

91.189.91.43    darkbowser.canonical.com

Then you will get a very fast speed.

snapspeed

1

The following works for me in China. Download speed increased from 20kB to 900kB/s.

sudo snap install snap-store-proxy
sudo snap install snap-store-proxy-client

I tried the answer by Genghis Yang but no improvement for me.

Kulfy
  • 17,696
1

Use dns checker service on the web to get the nearest ip of fastly.cdn.snapcraft.io, in my case it went up from 25KB/s to 25MB/s

84.200.69.80 (DNS.WATCH - DE)

enter image description here