AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1338355
Accepted
Aidan Reiss
Aidan Reiss
Asked: 2021-05-15 15:56:08 +0800 CST2021-05-15 15:56:08 +0800 CST 2021-05-15 15:56:08 +0800 CST

提高性能和减少启动时间的技巧 - Ubuntu 21.04

  • 772

我完成了 Ubuntu 21.04 的安装。我选择了超过 20.04 LTS 的版本,因为它本身不支持我的 wifi 适配器。我在不同的发行版中跳来跳去,试图找到启动时间最快的发行版。到目前为止,Xubuntu 21.04 是启动速度最快的版本,但是有问题,我不喜欢 Xfce。我试图减少启动时间,不是因为挑剔或“灵活”,而是因为我经营在线业务,每一分钟都很重要。如果这有帮助,这是我的电脑规格:

  • 2TB 5400 转 SATA
  • 12GB DDR4-2400 SDRAM
  • 802.11b/g/n/ac Wifi 和蓝牙 4.2 组合 (Realtek RTL8821ce)
  • Ubuntu 21.04 双启动与 Windows 10
  • AMD Athlon Gold 3150U(2.4GHz,最高 3.3 Ghz,1 MB L2 高速缓存,2 核),带 AMD Radeon 显卡

输出systemd-analyze blame:

1min 27.453s snapd.seeded.service
1min 17.267s plymouth-quit-wait.service
     16.950s networkd-dispatcher.service
     14.426s snapd.service
     10.870s NetworkManager-wait-online.service
     10.163s dev-sda6.device
      8.543s udisks2.service
      7.301s apparmor.service
      6.341s NetworkManager.service
      6.310s ModemManager.service
      6.216s accounts-daemon.service
      4.649s polkit.service
      4.227s thermald.service
      3.986s bluetooth.service
      3.986s avahi-daemon.service
      3.898s wpa_supplicant.service
      3.878s power-profiles-daemon.service
      3.734s apport.service
      3.699s switcheroo-control.service
      3.689s systemd-logind.service
      3.435s cups.service
      3.431s e2scrub_reap.service
      3.323s dev-loop2.device

输出systemd-analyze critical-chain:

graphical.target @2min 8.160s
└─multi-user.target @2min 8.160s
  └─snapd.seeded.service @40.705s +1min 27.453s
    └─snapd.service @26.271s +14.426s
      └─basic.target @25.806s
        └─sockets.target @25.805s
          └─snapd.socket @25.804s +1ms
            └─sysinit.target @25.558s
              └─snapd.apparmor.service @22.981s +2.577s
                └─apparmor.service @15.678s +7.301s
                  └─local-fs.target @15.676s
                    └─run-snapd-ns-snap\x2dstore.mnt.mount @1min 7.986s
                      └─run-snapd-ns.mount @1min 6.169s
                        └─local-fs-pre.target @6.251s
                          └─systemd-tmpfiles-setup-dev.service @6.201s +50ms
                            └─systemd-sysusers.service @4.618s +1.581s
                              └─systemd-remount-fs.service @4.243s +289ms
                                └─systemd-journald.socket @4.071s
                                  └─-.mount @4.063s
                                    └─-.slice @4.063s

输出systemd-analyze:

Startup finished in 5.921s (firmware) + 6.908s (loader) + 7.139s (kernel) + 2min 8.173s (userspace) = 2min 28.143s 
graphical.target reached after 2min 8.160s in userspace

对于@heynnema:

输出snap list:

Name                Version             Rev    Tracking         Publisher   Notes
core18              20210309            1997   latest/stable    canonical✓  base
core20              20210319            975    latest/stable    canonical✓  base
gnome-3-34-1804     0+git.3556cb3       66     latest/stable/…  canonical✓  -
gtk-common-themes   0.1-52-gb92ac40     1515   latest/stable/…  canonical✓  -
snap-store          3.38.0-59-g494f078  518    latest/stable/…  canonical✓  -
snapd               2.50                11841  latest/stable    canonical✓  snapd
whitesur-gtk-theme  3.4                 74     latest/stable    spider623   -

输出free -h:

 total        used        free      shared  buff/cache   available
Mem:          9.7Gi       1.8Gi       785Mi        70Mi       7.1Gi       7.5Gi
Swap:         2.0Gi       1.0Mi       2.0Gi

输出sysctl vm.swappiness:

vm.swappiness = 60

输出sudo lshw -C memory:

  *-firmware                
       description: BIOS
       vendor: AMI
       physical id: 0
       version: F.57
       date: 09/28/2020
       size: 64KiB
       capacity: 16MiB
       capabilities: pci upgrade shadowing cdboot bootselect edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer acpi usb smartbattery biosbootspecification netboot uefi
  *-memory
       description: System Memory
       physical id: 9
       slot: System board or motherboard
       size: 12GiB
     *-bank:0
          description: SODIMM DDR4 Synchronous Unbuffered (Unregistered) 3200 MHz (0.3 ns)
          product: HMA851S6DJR6N-XN
          vendor: Hynix
          physical id: 0
          serial: 22691E37
          slot: Bottom - Slot 1 (left)
          size: 4GiB
          width: 64 bits
          clock: 3200MHz (0.3ns)
     *-bank:1
          description: SODIMM DDR4 Synchronous Unbuffered (Unregistered) 2667 MHz (0.4 ns)
          product: AO1P26KC8T1-BXPS
          vendor: A-DATA Technology
          physical id: 1
          serial: 4FB00000
          slot: Bottom - Slot 2 (right)
          size: 8GiB
          width: 64 bits
          clock: 2667MHz (0.4ns)
  *-cache:0
       description: L1 cache
       physical id: b
       slot: L1 - Cache
       size: 192KiB
       capacity: 192KiB
       clock: 1GHz (1.0ns)
       capabilities: pipeline-burst internal write-back unified
       configuration: level=1
  *-cache:1
       description: L2 cache
       physical id: c
       slot: L2 - Cache
       size: 1MiB
       capacity: 1MiB
       clock: 1GHz (1.0ns)
       capabilities: pipeline-burst internal write-back unified
       configuration: level=2
  *-cache:2
       description: L3 cache
       physical id: d
       slot: L3 - Cache
       size: 4MiB
       capacity: 4MiB
       clock: 1GHz (1.0ns)
       capabilities: pipeline-burst internal write-back unified
       configuration: level=3

如果您需要更多输出,我将在下面应用编辑。任何帮助都会很棒。谢谢大家,祝大家有个愉快的一天!

startup
  • 1 1 个回答
  • 381 Views

1 个回答

  • Voted
  1. Best Answer
    heynnema
    2021-05-15T18:19:19+08:002021-05-15T18:19:19+08:00

    引导建议...

    磁盘

    如前所述,SSD 将对您的启动时间产生重大影响。1TB SSD 现在不到 100 美元。

    内存

    因为您拥有无与伦比的 RAM SODIMM/DIMM,所以您无法获得内存交错的速度优势。用 8G RAM 替换 4G RAM 会有所改善。

    AMD 处理器对 RAM 非常挑剔。建议运行内存测试。转到https://www.memtest86.com/并免费下载/运行它们memtest以测试您的记忆力。至少完成所有 4/4 测试以确认良好的记忆力。这可能需要几个小时才能完成。

    交换

    2G /swapfile 太小。我们将它增加到4G...

    注意rm:和命令的错误使用dd会导致数据丢失。建议复制/粘贴。

    在terminal...

    sudo swapoff -a           # turn off swap
    sudo rm -i /swapfile      # remove old /swapfile
    
    sudo dd if=/dev/zero of=/swapfile bs=1M count=4096
    
    sudo chmod 600 /swapfile  # set proper file protections
    sudo mkswap /swapfile     # init /swapfile
    sudo swapon /swapfile     # turn on swap
    free -h                   # confirm 12G RAM and 4G swap
    

    编辑 /etc/fstab,使用sudo -H gedit /etc/fstab或sudo pico /etc/fstab。

    在 /etc/fstab 中确认此 /swapfile 行...并确认没有其他“交换”行...在此行中使用空格...确认 NO TABS...

    /swapfile  none  swap  sw  0  0
    

    reboot                    # reboot and verify operation
    
    • 0

相关问题

  • 我可以记录恢复(取消休眠)需要多长时间吗?

  • Nautilus 在我杀死它之前不会显示我的桌面

  • bashrc 还是 bash_profile?

  • 如何在启动时运行脚本?

  • 遇到网络问题时,如何让 Empathy 重试连接

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve