Pi hole slow at loading some sites

I've been trying for a few days to improve the speed of loading sites on my MacBook. Here are some of the things I've tried already from searching the forums:

  • Ensure the IPv6 address is in setupVars.conf (my ISP doesn't support IPv6 but my router does via 6to4 tunnelling)
  • Add a firewall rule to REJECT all requests to 443
  • I've added OpenDNS and Google as IP4 & 6 DNS providers
  • Ensuring I have the latest updates of Pi Hole and Raspbian installed

Any help trying to figure out why many sites are slow would be muchly appreciated :slight_smile:

Expected Behaviour:

Sites should be loading faster than with pi hole disabled

Actual Behaviour:

Some ad heavy sites, e.g. www.wetter.com load very slowly

Debug Token:

vz1rqdnj0b

Open up the dev tools (F12) and then reload the site. Look in the Network tab for any requests which take a long time (>2 sec) and take note of those. Are they all blocked requests? For me, that site loads very quickly, without ads.

Hi,

I can see that it takes around 30s to get the following:

http://script.ioam.de/iam.js
http://www.wetter.com/${%20assetsBaseDir.replace('images/',%20'images/icons/small/'%20+%20weatherStateImage)%20}
http://www.wetter.com/${%20assetsBaseDir.replace('images/',%20'images/icons/medium/'%20+%20weatherStateImage).replace('_S.',%20'_M.')%20}

Can you take a screenshot of the "Timing" tab of the request?

I don't see a "Timing" tab. I've attached what I can see in Firefox.

It looks like blocked queries are not being rejected. What about if you go directly to one of the blocked queries?

If I copy the URL of one of the scripts that takes a while to fetch, then paste it into a new tab, then it takes a while and eventually displays a "Problem loading page" message, so a 404. Seems to me it takes quite some time to wait for the blocked page before giving up with a 404.

Is that via HTTPS? How about HTTP?

That's via HTTP. I read on another forum post about HTTPS issues and already configured iptables to REJECT requests on 443

Here's an example of one of the URLs from the list of long queries that I tried opening separately:

I get an immediate ERR_CONNECTION_REFUSED, as it is HTTPS.

Weird, when I pasted that URL in it was not HTTPS. I'll try and paste it again but add some spaces so it's not converted:

http: // pubads.g.doubleclick.net/

I get the block page immediately.

I went into my DNS settings on my computer, and found two entries. One is the IPv4 address of my router and the other is the IPv6 address of my router. If I manually add the IPv4 address of my Pi Hole machine, then everything loads much quicker.

In my router (a FRITZ!Box 6490) I had manually entered the DNS server to be the IPv4 and IPv6 of the Pi Hole device.

Interestingly I can't ping pi.hole from another machine. Is that relevant?

Yes, that means the machine is not using Pi-hole (or is trying to use Pi-hole alongside another DNS server).

Aha! I've cracked it. The FRITZ!Box is a pain to configure... For the benefit of others, I had specified the DNS Server under Internet -> Account Information -> DNS Server but that's not correct. It's necessary to go into Home Network -> Home Network Overview -> Network Settings -> IP4/6 Addresses then enter the IP address of the Pi Hole device under "Local DNS server".

Thanks for your fast help though, Mcat12! It helped me at least narrow down the problem.

I experienced the same issue:
--Slow loading of some websites
--Only from mobile and not from desktop
--On mobile only from browser and not from apps

I used tcpdump to gather a full pageload of the troublesome site from mobile and saw that the mobile device stalls for a minute a couple of times on CDN's.
I used tcpdump to gather the same pageload from desktop and did not see the traffic stalling. Page loaded in 2 secs instead of three minutes.
When comparing the two dumps I see that the traffic for mobile is different from the traffic from desktop. Different CDN's are used as well as the mobile using proxies to supposedly speed up pageloads. Traffic from proxy to CDN seems to be stalling the loads.
I also noticed that Pi Hole Always responded within milliseconds so is not the problem.

I will do further investigation and report back when I know more..

Some further results:
-Some websites load quick, others take minutes.
-Loading the 'slow' websites via 4G loads them quickly.
-Loading the 'slow' websites when PI Hole is disabled loads them quickly.
The above combined with the data from earlier post lets me assume that somewhere in the chain of CDN's a request for ads is blocked by pi-hole and is disrupting this chain of events. This will lead any of the CDN's to wait for a time-out. This causes the slowness.

Next thing I will do is whitelist all the blocked requests for a certain 'slow' page to prove the point...

Will report back..

Whitelisting does not help for this case. The problem is still that a site (google analytics in my case) is taking a minute to respond back, thus holding up the rest of the traffic. No clue why this only happens with mobile requests...

BTW: I tried to ask for the desktop page in the browser but that does not solve the issue...