使用 Firefox 和 Chromium 时,网站加载速度有时会很慢

使用 Firefox 和 Chromium 时,网站加载速度有时会很慢

在 Ubunustudio 上,网站有时加载速度非常慢。当我第一次访问该网站时(例如在谷歌上搜索某些内容),这种情况更常发生。该问题出现在 Firefox 和 Chromium 中。我已经尝试禁用 IP6,但没有帮助。除此之外,我还能测试什么吗?下载和上传速度都很好,我猜可能是由于解析地址?

我的系统:

System:
  Host: marco-MS-7817 Kernel: 5.4.0-47-lowlatency x86_64 bits: 64 
  Desktop: Xfce 4.14.2 Distro: Ubuntu 20.04.1 LTS (Focal Fossa) 
Machine:
  Type: Desktop Mobo: MSI model: H81M-E34 (MS-7817) v: 3.0 
  serial: <superuser/root required> BIOS: American Megatrends v: 17.5 
  date: 03/30/2015 
CPU:
  Topology: Quad Core model: Intel Core i5-4460 bits: 64 type: MCP 
  L2 cache: 6144 KiB 
  Speed: 3200 MHz min/max: 800/3200 MHz Core speeds (MHz): 1: 3200 2: 3200 
  3: 3200 4: 3200 
Graphics:
  Device-1: Intel Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics 
  driver: i915 v: kernel 
  Display: x11 server: X.Org 1.20.8 driver: modesetting unloaded: fbdev,vesa 
  resolution: 1920x1080~60Hz 
  OpenGL: renderer: Mesa DRI Intel HD Graphics 4600 (HSW GT2) 
  v: 4.5 Mesa 20.0.8 
Audio:
  Device-1: Intel Xeon E3-1200 v3/4th Gen Core Processor HD Audio 
  driver: snd_hda_intel 
  Device-2: BEHRINGER UMC204HD 192k type: USB driver: snd-usb-audio 
  Device-3: AKAI Professional M.I. type: USB 
  driver: hid-generic,snd-usb-audio,usbhid 
  Sound Server: ALSA v: k5.4.0-47-lowlatency 
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet 
  driver: r8169 
  IF: enp2s0 state: up speed: 1000 Mbps duplex: full mac: d8:cb:8a:e8:e9:99 
Drives:
  Local Storage: total: 523.08 GiB used: 159.23 GiB (30.4%) 
  ID-1: /dev/sda vendor: Samsung model: SSD 850 EVO 250GB size: 232.89 GiB 
  ID-2: /dev/sdb type: USB vendor: Samsung model: Portable SSD T5 
  size: 232.89 GiB 
  ID-3: /dev/sdc type: USB vendor: SanDisk model: Ultra size: 57.30 GiB 
Partition:
  ID-1: / size: 36.41 GiB used: 12.45 GiB (34.2%) fs: ext4 dev: /dev/sda1 
  ID-2: /home size: 184.23 GiB used: 66.59 GiB (36.1%) fs: ext4 
  dev: /dev/sda6 
  ID-3: swap-1 size: 7.45 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/sda5 
Sensors:
  System Temperatures: cpu: 41.0 C mobo: N/A 
  Fan Speeds (RPM): N/A 
Info:
  Processes: 260 Uptime: 20m Memory: 7.23 GiB used: 3.97 GiB (54.9%) 
  Shell: bash inxi: 3.0.38 

编辑:

 sudo lshw -C network
[sudo] Passwort für marco: 
  *-network                 
       Beschreibung: Ethernet interface
       Produkt: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       Hersteller: Realtek Semiconductor Co., Ltd.
       Physische ID: 0
       Bus-Informationen: pci@0000:02:00.0
       Logischer Name: enp2s0
       Version: 0c
       Seriennummer: d8:cb:8a:e8:e9:99
       Größe: 1Gbit/s
       Kapazität: 1Gbit/s
       Breite: 64 bits
       Takt: 33MHz
       Fähigkeiten: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       Konfiguration: autonegotiation=on broadcast=yes driver=r8169 duplex=full firmware=rtl8168g-2_0.0.1 02/06/13 ip=192.168.178.23 latency=0 link=yes multicast=yes port=MII speed=1Gbit/s
       Ressourcen: irq:18 ioport:e000(Größe=256) memory:f7d00000-f7d00fff memory:f0000000-f0003fff

ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether d8:cb:8a:e8:e9:99 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.23/24 brd 192.168.178.255 scope global dynamic noprefixroute enp2s0
       valid_lft 862605sec preferred_lft 862605sec

@tracepath

当我执行它时,一开始我会得到 1500,但第二次我得到 1492,这似乎是更好的值。也许这解释了为什么有时我第一次尝试加载页面时会遇到问题。我在哪里可以永久将 MTU 设置为 1492?

tracepath www.google.com
 1?: [LOCALHOST]                      pmtu 1500
 1:  fritz.box                                             7.938ms 
 1:  wpad.fritz.box                                        1.830ms 
 2:  x4db53c5a.dyn.telefonica.de                           2.639ms pmtu 1492
 2:  loopback1.0003.acln.02.fra.de.net.telefonica.de      14.828ms 
 3:  bundle-ether30.0004.dbrx.02.fra.de.net.telefonica.de  16.144ms 
 4:  bundle-ether1.0004.prrx.02.fra.de.net.telefonica.de  15.519ms 
 5:  72.14.213.76                                         16.803ms asymm 10 
 6:  keine Antwort
 7:  keine Antwort
 8:  keine Antwort
 9:  keine Antwort
10:  keine Antwort
11:  keine Antwort
12:  keine Antwort
13:  keine Antwort
14:  keine Antwort
15:  keine Antwort
16:  keine Antwort
17:  keine Antwort
18:  keine Antwort
19:  keine Antwort
20:  keine Antwort
21:  keine Antwort
22:  keine Antwort
23:  keine Antwort
24:  keine Antwort
25:  keine Antwort
26:  keine Antwort
27:  keine Antwort
28:  keine Antwort
29:  keine Antwort
30:  keine Antwort
     Too many hops: pmtu 1492
     Resume: pmtu 1492 

9 月 28 日添加了更多信息....

链接到具有 MTU 设置的图像文件:https://i.stack.imgur.com/LKkGK.png

systemd-resolve --status
Global
       LLMNR setting: no                  
MulticastDNS setting: no                  
  DNSOverTLS setting: no                  
      DNSSEC setting: no                  
    DNSSEC supported: no                  
          DNS Domain: fritz.box           
          DNSSEC NTA: 10.in-addr.arpa     
                      16.172.in-addr.arpa 
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa 
                      18.172.in-addr.arpa 
                      19.172.in-addr.arpa 
                      20.172.in-addr.arpa 
                      21.172.in-addr.arpa 
                      22.172.in-addr.arpa 
                      23.172.in-addr.arpa 
                      24.172.in-addr.arpa 
                      25.172.in-addr.arpa 
                      26.172.in-addr.arpa 
                      27.172.in-addr.arpa 
                      28.172.in-addr.arpa 
                      29.172.in-addr.arpa 
                      30.172.in-addr.arpa 
                      31.172.in-addr.arpa 
                      corp                
                      d.f.ip6.arpa        
                      home                
                      internal            
                      intranet            
                      lan                 
                      local               
                      private             
                      test                

Link 2 (enp2s0)
      Current Scopes: DNS          
DefaultRoute setting: yes          
       LLMNR setting: yes          
MulticastDNS setting: no           
  DNSOverTLS setting: no           
      DNSSEC setting: no           
    DNSSEC supported: no           
  Current DNS Server: 192.168.178.1
         DNS Servers: 192.168.178.1
          DNS Domain: ~.           
                      fritz.box    
lines 25-47/47 (END)
                      31.172.in-addr.arpa 
                      corp                
                      d.f.ip6.arpa        
                      home                
                      internal            
                      intranet            
                      lan                 
                      local               
                      private             
                      test                

Link 2 (enp2s0)
      Current Scopes: DNS          
DefaultRoute setting: yes          
       LLMNR setting: yes          
MulticastDNS setting: no           
  DNSOverTLS setting: no           
      DNSSEC setting: no           
    DNSSEC supported: no           
  Current DNS Server: 192.168.178.1
         DNS Servers: 192.168.178.1
          DNS Domain: ~.           
                      fritz.box    
~

ls -al /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Sep 27 22:10 /etc/resolv.conf -> ../run/resolvconf/resolv.conf



 cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.53
search fritz.box




dpkg -l *dnsmasq* | grep ii
ii  dnsmasq-base     2.80-1.1ubuntu1 amd64        Small caching DNS proxy and DHCP/TFTP server

答案1

您的问题可能出在您的 DSL 连接的 MTU 设置上。

enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500

Ubuntu 的网络配置中有一个 MTU 设置,而路由器中有一个 WAN MTU 设置。

对于 DSL,常见的 MTU 设置是 1492。请先尝试此值,然后查看您的网站现在是否可以访问。

在此处输入图片描述

要确定正确的设置,请从所有 MTU 设置 = 1500 和 VPN = 关闭开始。(VPN 需要不同的测试)。

在终端中:

ping [-c count] [-M do] [-s packet_size] [host]

使用的选项是:

  • c count:ping 次数
  • M hint:选择路径 MTU 发现策略。可以是do(禁止碎片,即使是本地碎片),want(进行 PMTU 发现,当数据包大小较大时在本地进行碎片),或dont(不设置 DF 标志)。
  • s packet_size:指定要发送的数据字节数。

您应该始终从 1472 开始,然后每次减少 10。一旦收到回复,就增加 1,直到收到碎片数据包。取该值(最后一个好值)并将 28 添加到该值以考虑各种 TCP/IP 标头。例如,假设 1452 是合适的数据包大小(您第一次收到对 ping 的 ICMP 回复)。实际的 MTU 大小将是 1480,这是我们正在使用的网络的最佳值。

    ping -c 4 -M do -s 1472 8.8.8.8# 这可能会显示碎片

    ping -c 4 -M do -s 1462 8.8.8.8# 可能会显示碎片

    ping -c 4 -M do -s 1452 8.8.8.8# 没有碎片?

    ping -c 4 -M do -s 1453 8.8.8.8# 仍然没有碎片?

参考:如何使用 ICMP ping 确定适当的 MTU 大小

相关内容