DEV: Improve `bin/unicorn` boot time in development environment (PR #12900)

This commit makes a few changes to improve boot time in development environments. It will have no effect on production boot times.

  • Skip the SchemaCache warmup. In development mode, the SchemaCache is refreshed every time there is a code change, so warmup is of limited use. Instead, we can use Rails’s filesystem-based SchemaCache. This should also speed up requests in development environments, because it completely eliminates the need for ‘DDL’ queries.

  • Skip warming up PrettyText. This adds ~2s to each web worker’s boot time. The vast majority of requests do not use PrettyText, so it is more efficient to defer its warmup until it’s needed

  • Skip the intentional 1 second pause during Unicorn worker forking. The comment (which also exists in Unicorn’s documentation) suggests this works around a Unix signal handling bug, but I haven’t been able to locate any more information. Skipping it in dev will significantly speed up boot. If we start to see issues, we can revert this change.

On my machine, this improves /bin/unicorn boot time from >10s to ~4s

GitHub