主机名查找缓慢:curl 缓慢、sudo 缓慢、浏览器缓慢

主机名查找缓慢:curl 缓慢、sudo 缓慢、浏览器缓慢

我的问题与其他主机名查找缓慢的问题类似,但我找不到可行的解决方案。主要影响是sudo命令缓慢,所有浏览器中的 DNS 解析都非常缓慢。

我猜这可能与 IPv6 有关,因为仅支持 IPv6 的主机速度很快,仅支持 IPV4 的主机速度也很快。

我已经尝试禁用 dnsmasq,但没有成功。我尝试禁用 IPv6,但没有成功。我尝试添加更多本地主机名,但/etc/hosts没有成功。我禁用了 avahi,但没有成功。我已更改/etc/gai.conf为首选 IPv4 地址

以下是一些测量结果:

wget google.de(7 s 主机名查找)

LANG=C ltrace -c wget www.google.de > /dev/null     
--2016-01-12 11:46:21--  http://www.google.de/
Resolving www.google.de (www.google.de)... 216.58.213.227, 2a00:1450:4005:80a::2003
Connecting to www.google.de (www.google.de)|216.58.213.227|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
]  19.03K  --.-KB/s   in 0.1s   

2016-01-12 11:46:29 (161 KB/s) - 'index.html' saved [19485]

% time     seconds  usecs/call     calls      function
------ ----------- ----------- --------- --------------------
 93.87    7.278115     7278115         1 getaddrinfo
  3.67    0.284775       21905        13 select
  1.59    0.123508      123508         1 connect
------ ----------- ----------- --------- --------------------
100.00    7.753422                  1488 total

wget ipv6.google.com (快速)

LANG=C ltrace -c wget ipv6.google.com > /dev/null 
--2016-01-12 11:49:32--  http://ipv6.google.com/
Resolving ipv6.google.com (ipv6.google.com)... 2a00:1450:4001:80f::1000
Connecting to ipv6.google.com (ipv6.google.com)|2a00:1450:4001:80f::1000|:80... failed: Network is unreachable.
% time     seconds  usecs/call     calls      function
------ ----------- ----------- --------- --------------------
 27.47    0.057921         164       352 free
 20.85    0.043962       43962         1 getaddrinfo
 19.47    0.041057         164       249 strlen
 10.73    0.022616         166       136 __getdelim
------ ----------- ----------- --------- --------------------
100.00    0.210827                   990 total

sudo echo (17 s getifaddrs)

ltrace -c sudo echo
% time     seconds  usecs/call     calls      function
------ ----------- ----------- --------- --------------------
 99.13   17.780254    17780254         1 getifaddrs
  0.20    0.036729       18364         2 getpwuid
  0.12    0.021369       10684         2 sudo_dso_load_v1
------ ----------- ----------- --------- --------------------
100.00   17.935858                   377 total

是否配置

而且 ifconfig 也相当慢:

time ifconfig (12s)
enp8s0    Link encap:Ethernet  Hardware Adresse 30:65:ec:90:56:10  
          inet Adresse:192.168.30.248  Bcast:192.168.30.255  Maske:255.255.255.0
          inet6-Adresse: fe80::3265:ecff:fe90:5610/64 Gültigkeitsbereich:Verbindung
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX-Pakete:205501 Fehler:0 Verloren:4 Überläufe:0 Fenster:0
          TX-Pakete:114430 Fehler:0 Verloren:0 Überläufe:0 Träger:0
          Kollisionen:0 Sendewarteschlangenlänge:1000 
          RX-Bytes:224844319 (224.8 MB)  TX-Bytes:15414295 (15.4 MB)

lo        Link encap:Lokale Schleife  
          inet Adresse:127.0.0.1  Maske:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metrik:1
          RX-Pakete:12127 Fehler:0 Verloren:0 Überläufe:0 Fenster:0
          TX-Pakete:12127 Fehler:0 Verloren:0 Überläufe:0 Träger:0
          Kollisionen:0 Sendewarteschlangenlänge:0 
          RX-Bytes:938479 (938.4 KB)  TX-Bytes:938479 (938.4 KB)

real    0m12.400s
user    0m0.004s
sys     0m0.000s

这是我现在的/etc/hosts

127.0.0.1       localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.1.1       sebastian-Aspire-VN7-592G

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

我已在 中禁用 IPv6 /etc/sysctl.conf,但这也没有什么区别:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.enp8s0.disable_ipv6 = 1
net.ipv6.conf.all.accept_ra = 0

如上所述,我已经禁用了 dnsmasq。这是我当前的/etc/resolve.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
nameserver 127.0.1.1
search foo.local

我在最近的笔记本电脑上安装了 15.10,缺少一些硬件驱动程序,但目前这并不重要。以下是一些dmesg输出:

[ 6324.582308] WARNING: CPU: 6 PID: 878 at /build/linux-AFqQDb/linux-4.2.0/drivers/gpu/drm/i915/intel_pm.c:3404 skl_update_other_pipe_wm+0x1de/0x1f0 [i915]()
[ 6324.582313] WARN_ON(!wm_changed)
[ 6324.582317] Modules linked in:
[ 6324.582322]  hid_cherry rfcomm hid_generic usbhid arc4 rtsx_usb_ms memstick binfmt_misc bnep hid_multitouch joydev snd_hda_codec_hdmi acer_wmi i2c_designware_platform snd_hda_codec_realtek intel_rapl iosf_mbi i2c_designware_core nls_iso8859_1 snd_hda_codec_generic sparse_keymap x86_pkg_temp_thermal intel_powerclamp snd_hda_intel coretemp snd_hda_codec snd_hda_core snd_hwdep kvm_intel snd_pcm kvm snd_seq_midi snd_seq_midi_event snd_rawmidi crct10dif_pclmul crc32_pclmul snd_seq snd_seq_device aesni_intel snd_timer aes_x86_64 snd lrw gf128mul glue_helper uvcvideo ablk_helper videobuf2_vmalloc videobuf2_memops cryptd videobuf2_core ath10k_pci(OE) v4l2_common ath10k_core(OE) input_leds ath(OE) videodev idma64 mac80211(OE) virt_dma btusb media serio_raw btrtl btbcm soundcore cfg80211(OE) btintel mei_me
[ 6324.582428]  compat(OE) bluetooth mei intel_lpss_pci shpchp acpi_als kfifo_buf industrialio intel_lpss_acpi intel_lpss mac_hid tpm_crb acpi_pad parport_pc ppdev lp parport autofs4 btrfs xor raid6_pq rtsx_usb_sdmmc rtsx_usb nouveau i915 mxm_wmi ttm i2c_algo_bit drm_kms_helper r8169 ahci drm mii libahci i2c_hid hid wmi video pinctrl_sunrisepoint pinctrl_intel
[ 6324.582492] CPU: 6 PID: 878 Comm: Xorg Tainted: G        W  OE   4.2.0-23-generic #28-Ubuntu
[ 6324.582497] Hardware name: Acer Aspire VN7-592G/Aspire VN7-592G, BIOS V1.03 09/25/2015
[ 6324.582501]  0000000000000000 00000000a1b5af30 ffff8804ab143518 ffffffff817e94c9
[ 6324.582508]  0000000000000000 ffff8804ab143570 ffff8804ab143558 ffffffff8107b3d6
[ 6324.582514]  ffff8804ab143620 ffff8804ab1436c4 ffff8804b067a000 ffff8804a8c58000
[ 6324.582519] Call Trace:
[ 6324.582531]  [<ffffffff817e94c9>] dump_stack+0x45/0x57
[ 6324.582541]  [<ffffffff8107b3d6>] warn_slowpath_common+0x86/0xc0
[ 6324.582549]  [<ffffffff8107b465>] warn_slowpath_fmt+0x55/0x70
[ 6324.582580]  [<ffffffffc019eb9e>]     skl_update_other_pipe_wm+0x1de/0x1f0 [i915]
[ 6324.582610]  [<ffffffffc019ed6b>] skl_update_wm+0x1bb/0x740 [i915]
[ 6324.582665]  [<ffffffffc01ea837>] ? gen9_read32+0xf7/0x2d0 [i915]
[ 6324.582712]  [<ffffffffc01d32a2>] ? i915_get_vblank_timestamp+0x62/0xa0 [i915]
[ 6324.582741]  [<ffffffffc01a24be>] intel_update_watermarks+0x1e/0x30 [i915]
[ 6324.582830]  [<ffffffffc0205ad9>] intel_finish_crtc_commit+0x169/0x190 [i915]
[ 6324.582862]  [<ffffffffc010c793>] drm_atomic_helper_commit_planes_on_crtc+0x143/0x260 [drm_kms_helper]
[ 6324.582914]  [<ffffffffc021ee3b>] intel_atomic_commit+0x6b/0x100 [i915]
[ 6324.582960]  [<ffffffffc00c9d47>] drm_atomic_commit+0x37/0x60 [drm]
[ 6324.582982]  [<ffffffffc010b0cf>] drm_atomic_helper_disable_plane+0xef/0x130 [drm_kms_helper]
[ 6324.582993]  [<ffffffff81211780>] ? poll_select_copy_remaining+0x140/0x140
[ 6324.583028]  [<ffffffffc00b993a>] __setplane_internal+0x23a/0x2f0 [drm]
[ 6324.583040]  [<ffffffff81211780>] ? poll_select_copy_remaining+0x140/0x140
[ 6324.583070]  [<ffffffffc00b9b1b>] drm_mode_cursor_universal+0x12b/0x210 [drm]
[ 6324.583082]  [<ffffffff817edfff>] ? __ww_mutex_lock+0x5f/0xa0
[ 6324.583108]  [<ffffffffc00b9c81>] drm_mode_cursor_common+0x81/0x180 [drm]
[ 6324.583150]  [<ffffffffc00bdca0>] drm_mode_cursor_ioctl+0x50/0x70 [drm]
[ 6324.583179]  [<ffffffffc00ae495>] drm_ioctl+0x125/0x610 [drm]
[ 6324.583209]  [<ffffffffc00bdc50>] ? drm_mode_setcrtc+0x500/0x500 [drm]
[ 6324.583219]  [<ffffffff81210aa5>] do_vfs_ioctl+0x295/0x480
[ 6324.583232]  [<ffffffff81087ff1>] ? __set_task_blocked+0x41/0xa0
[ 6324.583243]  [<ffffffff81210d09>] SyS_ioctl+0x79/0x90
[ 6324.583253]  [<ffffffff8108ac1e>] ? SyS_rt_sigprocmask+0x8e/0xc0
[ 6324.583264]  [<ffffffff817f02b2>] entry_SYSCALL_64_fastpath+0x16/0x75
[ 6324.583269] ---[ end trace a58faf031edb4763 ]---
[ 6331.993913] ath10k_pci 0000:07:00.0: failed to enable dynamic BW: -11
[ 6334.993516] ath10k_pci 0000:07:00.0: could not suspend target (-11)
[ 6343.280298] ath10k_pci 0000:07:00.0: failed to enable dynamic BW: -11
[ 6346.279898] ath10k_pci 0000:07:00.0: could not suspend target (-11)
[ 6354.562809] ath10k_pci 0000:07:00.0: failed to enable dynamic BW: -11
[ 6357.562422] ath10k_pci 0000:07:00.0: could not suspend target (-11)
[ 6365.849382] ath10k_pci 0000:07:00.0: failed to enable dynamic BW: -11
[ 6368.848990] ath10k_pci 0000:07:00.0: could not suspend target (-11)
[ 6377.131779] ath10k_pci 0000:07:00.0: failed to enable dynamic BW: -11
[ 6380.131451] ath10k_pci 0000:07:00.0: could not suspend target (-11)
[ 6388.418249] ath10k_pci 0000:07:00.0: failed to enable dynamic BW: -11
[ 6391.417812] ath10k_pci 0000:07:00.0: could not suspend target (-11)
[ 6399.700733] ath10k_pci 0000:07:00.0: failed to set arp ac override parameter: -11
[ 6402.700337] ath10k_pci 0000:07:00.0: could not suspend target (-11)
[ 6410.987318] ath10k_pci 0000:07:00.0: failed to enable dynamic BW: -11
[ 6413.986925] ath10k_pci 0000:07:00.0: could not suspend target (-11)
[ 6422.269736] ath10k_pci 0000:07:00.0: failed to enable dynamic BW: -11
[ 6425.269385] ath10k_pci 0000:07:00.0: could not suspend target (-11)
[ 6433.552295] ath10k_pci 0000:07:00.0: failed to enable dynamic BW: -11
[ 6436.551869] ath10k_pci 0000:07:00.0: could not suspend target (-11)
[ 6444.834788] ath10k_pci 0000:07:00.0: failed to enable dynamic BW: -11
[ 6447.834366] ath10k_pci 0000:07:00.0: could not suspend target (-11)
[ 6456.117158] ath10k_pci 0000:07:00.0: failed to enable dynamic BW: -11

Ubuntu 15.10

答案1

黑名单ath10k_pci解决了该问题:

$ cat /etc/modprobe.d/blacklist-local.conf 
blacklist ath10k_pci

我猜这是由我的 wifi 卡引起的,它很新。我将尝试使用下一个 Ubuntu 版本再次激活它。

相关内容