rails-boot-profiling
Rails Boot Time Profiling
Profile Rails application boot time using the require-profiler gem. This skill helps identify which require, load, YAML, HTTP, and Rails initialization steps dominate startup time, and provides tools to drill deeper into slow files.
Prerequisites
Before profiling, ensure these conditions are met:
-
The
require-profilergem is in the Gemfile (at minimum in the development group). -
Pick the boot to measure with
config.eager_loadin the target environment config: keep itfalseto profile the development boot (lazily-loaded application code stays out of the profile), or set it totrueto profile a production-like boot (all application code loads and shows up). Default to the development boot unless the user asks about production or CI. -
Add
-W0to the Ruby command to suppress warnings and keep output clean. -
If the app uses Spring, disable it while profiling (
DISABLE_SPRING=1). Otherwise you measure a fork of a preloaded process instead of a real boot.
Step 1: Run a Full Boot Profile
Run the base profiling command: