YIO-Remote / remote-os

💎 Buildroot OS for YIO remote
GNU General Public License v3.0
13 stars 9 forks source link

Improve cold boot speed #30

Open martonborzak opened 4 years ago

martonborzak commented 4 years ago

Expected Behavior or Design

Faster boot and load time.

Current Behavior or Design

Currently the boot and load time takes quite a bit.

Possible Solution

I believe with optimising systemd services and their order we can improve the boot time.

Detailed Description and Additional Information

https://www.youtube.com/watch?v=4Fjfqz6FxC8

zehnm commented 4 years ago

Some more information about reducing splash screen loading times & boot optimizations:

zehnm commented 4 years ago

Framebuffer timings on RPi0:

time fbv -d 1 /opt/yio/media/splash/update.png
real    0m 0.21s
user    0m 0.10s
sys 0m 0.00s

cp /dev/fb0 /opt/yio/media/splash/update.fb
time dd if=/opt/yio/media/splash/update.fb of=/dev/fb0 bs=1536000 count=1
real    0m 0.03s
user    0m 0.00s
sys 0m 0.02s

The 1.5 MB framebuffer image could be compressed tremendously with LZO and reduce SD card reading time.

zehnm commented 4 years ago

With a really old and slow SD card:

# systemd-analyze blame
          3.999s dev-mmcblk0p2.device
          2.547s systemd-udev-trigger.service
          1.485s systemd-resolved.service
          1.053s systemd-journal-flush.service
           919ms systemd-journald.service
           802ms bluetooth.service
           693ms systemd-networkd.service
           567ms avahi-daemon.service
           481ms systemd-remount-fs.service
           480ms tmp.mount
           476ms sys-kernel-debug.mount
           468ms systemd-modules-load.service
           461ms systemd-udevd.service
           459ms systemd-tmpfiles-setup-dev.service
           436ms systemd-fsck-root.service
           362ms ntpd.service
           357ms dropbear.service
           350ms systemd-update-utmp-runlevel.service
           324ms dev-mqueue.mount
           275ms sys-kernel-config.mount
           262ms kmod-static-nodes.service
           254ms systemd-tmpfiles-setup.service
           228ms systemd-sysctl.service
           193ms systemd-update-utmp.service
           111ms boot.mount
           106ms systemd-tmpfiles-clean.service

There's some stuff to optimize...

This should be our benchmark: Booting Linux In Just One Second :-)

zehnm commented 3 years ago

While working on remote-os release v2 I've noticed that we could gain a lot of time by setting the systemd dependencies of the app.service. If we start the app right after the file systems are available and don't wait on the network, it would startup much faster. However, the app then needs to check for network availability and postpone integration startup, until the network is ready.