Slow local network initial HTTP requests

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

Phantomski

Occasional Visitor
Hi,

I’m troubleshooting strange issue with slow response web browsing on local network. I’m running a few webservers on few local network devices, some on WiFi, some ethernet. It’s fairly standard setup - RT-AC88U on 384.18, one local subnet, DHCP preset allocated IPv4 addresses. IPv6 off. DNSmasq using dnsmasq.conf.add edits for few local domain names. Skynet, nsrum, connmon, spdMerlin. Adaptive / fq_codel QoS.

Usually it’s just the first initial HTTP request - sometimes it takes 3-4 seconds before the first page loads up, sometimes the request times out. It usually works well after the initial page loads up with all the other subsequent content onwards. It happens across all the webservers, WiFi or Ethernet (including the router’s webUI), different types (Apache, nginx,...), different operating systems and devices. It doesn’t happen on any external internet websites which load instantly, just the local network.

- At first I thought it’s DNS getting stuck, but all the nslookup queries are resolved instantly
- Then I thought DNSmasq might be an issue, but connection to other services like SSH or SMB is instant as well using the local domain names
- Disabling QoS makes no difference
- Nothing strange on ping, everything is fast and no drops.
- Nothing noticeable in the logs
- No router CPU or memory overload

It’s purely web browsing, it’s the same in all the browsers I’ve tried (Safari, Edge, Firefox), from any local network client devices to any local server devices, regardless of using IP address or local domain name. It only happens on the first attempt initially, after longer period of inactivity and then works ok.

What might be wrong?
 

Treadler

Very Senior Member
Hi,

I’m troubleshooting strange issue with slow response web browsing on local network. I’m running a few webservers on few local network devices, some on WiFi, some ethernet. It’s fairly standard setup - RT-AC88U on 384.18, one local subnet, DHCP preset allocated IPv4 addresses. IPv6 off. DNSmasq using dnsmasq.conf.add edits for few local domain names. Skynet, nsrum, connmon, spdMerlin. Adaptive / fq_codel QoS.

Usually it’s just the first initial HTTP request - sometimes it takes 3-4 seconds before the first page loads up, sometimes the request times out. It usually works well after the initial page loads up with all the other subsequent content onwards. It happens across all the webservers, WiFi or Ethernet (including the router’s webUI), different types (Apache, nginx,...), different operating systems and devices. It doesn’t happen on any external internet websites which load instantly, just the local network.

- At first I thought it’s DNS getting stuck, but all the nslookup queries are resolved instantly
- Then I thought DNSmasq might be an issue, but connection to other services like SSH or SMB is instant as well using the local domain names
- Disabling QoS makes no difference
- Nothing strange on ping, everything is fast and no drops.
- Nothing noticeable in the logs
- No router CPU or memory overload

It’s purely web browsing, it’s the same in all the browsers I’ve tried (Safari, Edge, Firefox), from any local network client devices to any local server devices, regardless of using IP address or local domain name. It only happens on the first attempt initially, after longer period of inactivity and then works ok.

What might be wrong?

Clutching at straws here, in ‘tools’, ‘other settings’, set Wan: Use local caching DNS server as system resolver (default: No)?
If that does nothing, try setting it to ‘yes’. (Shrug).:oops:
 

Phantomski

Occasional Visitor
Clutching at straws here, in ‘tools’, ‘other settings’, set Wan: Use local caching DNS server as system resolver (default: No)?
If that does nothing, try setting it to ‘yes’. (Shrug).:oops:

Hmmm, interesting, “yes” seems to make stuff much better now, thank you!

Now for the more complicated - why ;)

- From the webUI description of this setting, it seems almost obvious it needs to be “yes” if you’re using dnsmasq, as you want the router to send queries to dnsmasq rather than to upstream DNS (which would be the ISP or somewhere you’d want WAN requests to go). Fair enough, I’d completely missed this. If it’s indeed the case perhaps it needs to be part of the dnsmasq description in Merlin’s Wiki, what do you think @RMerlin ? Also from the description - it should only affect router, not clients.

- On the other hand, there’s supposed to be another setting, that IS part of the Wiki DHCP description and that is Forward local domain queries to upstream DNS which at least in my v384.18 is not present in LAN / DHCP Server, but in WAN / Internet Connection / WAN DNS setting.

Still not 100% sure why it helped (nslookup queries worked well and quick and everything bar HTTP worked fast too), but it did and from the explanation it makes great sense - most likely the delay was due to local DNS queries, at least for HTTP, being sent to upstream DNS first and only if not resolved sent to dnsmasq. Just my guess though, I’d appreciate a heads up if there’s a way to monitor or confirm this. What is not clear to me is that it also says this will not affect clients, only router itself. Opposite seems to be the case.

It almost seems like it’s not working as designed, or (more likely) I still don‘t understand it properly.
- The DHCP setting tells my clients what is their DNS to go (only DNS 1, in my case router’s IP). Simple enough. Everything goes to router which decides what happens next.
- The WAN setting can change that behaviour in a way, that if I do want an extra upstream DNS instead and do not want to use dnsmasq local domain setting, I can set this to Yes. So the dnsmasq still works, just forwards local domain queries upstream. Perhaps I want clients to use local domains and I don’t want to manually edit /jffs/configs/dnsmasq.conf.add all the time and restart dnsmasq, but use a separate DNS server, not the router itself. Also, simple enough.
- The Tools / Other settings from the description should not relate to client’s DNS queries, just to router’s. Perhaps I might want clients to be redirected to a local web server instead of “forbidden internet site” using dnsmasq or separate DNS server as in the WAN setting above, but I still want router to be unrestricted and use upstream DNS. Now this one is less clear.

Yet the combination of router IP as DNS1 / No / No didn’t work well for local DNS queries and router IP as DNS1 / No / Yes did work, even though it should not affect clients, just the router.

Confused.com
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top