Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
boottime [2022/03/24 21:54] – Update to current status. ColinPercivalboottime [2023/07/25 13:34] (current) – Consistent with <https://github.com/cperciva/freebsd-boot-profiling/pull/3> for USAGE. GrahamPerrin
Line 1: Line 1:
-===== Introduction =====+===== Boot Performance =====
  
 ColinPercival is coordinating an effort to speed up the %%FreeBSD%% boot process and would like to see %%FreeBSD%% become far more competitive in 14.0. Some improvements have already been made since 13.0. ColinPercival is coordinating an effort to speed up the %%FreeBSD%% boot process and would like to see %%FreeBSD%% become far more competitive in 14.0. Some improvements have already been made since 13.0.
Line 9: Line 9:
 Boot time consists of four consecutive stages: Boot time consists of four consecutive stages:
  
-  - System: BIOS/UEFI, before running any %%FreeBSD%% code -- we can't do anything about this.+  - System: BIOS/UEFI, before running any %%FreeBSD%% code – we can't do anything about this.
   - %%FreeBSD%%: boot loader.   - %%FreeBSD%%: boot loader.
   - %%FreeBSD%%: kernel, before init starts running.   - %%FreeBSD%%: kernel, before init starts running.
Line 15: Line 15:
  
 ===== Boot Profiling ===== ===== Boot Profiling =====
-The boot loader and kernel can be profiled using the TSLOG framework to generate a flamechart.  To do this: 
  
-  - Build a kernel with 'options TSLOG'. +For visual analysis of the four stages: use [[https://man.freebsd.org/cgi/man.cgi?query=tslog&sektion=4&manpath=freebsd-release|tslog(4)]] buffer dumps to generate flame graphs. 
-  - Check out the [[https://github.com/cperciva/freebsd-boot-profiling|freebsd-boot-profiling repository]] + 
-  - Run ''%%sh mkflame.sh > tslog.svg%%''+For example, run the following command to extend the GENERIC kernel configuration file for %%FreeBSD%%/amd64: 
 + 
 +''%%printf '%s\n' '' 'options         TSLOG                   # <https://wiki.freebsd.org/BootTime#tslog>' >> /usr/src/sys/amd64/conf/GENERIC%%'' 
 + 
 +– then build, install and use the GENERIC kernel. 
 + 
 +Checkout the [[https://github.com/cperciva/freebsd-boot-profiling|freebsd-boot-profiling repository]], ''%%cd%%'' to the checkout, then run: 
 + 
 +''%%sh mkflame.sh > tslog.svg%%''
  
 ===== Current Performance ===== ===== Current Performance =====
Line 44: Line 51:
 Loader (~260 ms, more on first boot): Loader (~260 ms, more on first boot):
   * Reading the kernel from disk takes ~150 ms. This would be faster with a smaller and/or a compressed kernel, but tooling work would be needed for kernel updates.  This sometimes takes longer the first time an instance boots, possibly due to the underlying disk being "lazily" initialized from the backing EC2 snapshot.   * Reading the kernel from disk takes ~150 ms. This would be faster with a smaller and/or a compressed kernel, but tooling work would be needed for kernel updates.  This sometimes takes longer the first time an instance boots, possibly due to the underlying disk being "lazily" initialized from the backing EC2 snapshot.
-    * The first time an EC2 instance boots, this I/O takes longer -- about 500 ms is spent on loader I/O when the "disk cache" is cold.+    * The first time an EC2 instance boots, this I/O takes longer – about 500 ms is spent on loader I/O when the "disk cache" is cold.
   * The loader spends ~45 ms printing status information to the console.   * The loader spends ~45 ms printing status information to the console.
   * The loader spends ~65 ms on other stuff (reading in the lua scripts, loading fonts, etc).   * The loader spends ~65 ms on other stuff (reading in the lua scripts, loading fonts, etc).
  • boottime.1648158874.txt.gz
  • Last modified: 2022/03/24 21:54
  • by ColinPercival