Blogs›Shopify›Ruby App Boot Time Optimization
Ruby App Boot Time Optimization
This feature thread tracks the development and enhancement of Ruby application boot time optimization at Shopify. Initial efforts focused on addressing the substantial time spent waiting for Rails to boot in the monolithic application, impacting developer iteration speed. This post details the introduction of Bootsnap, a gem that optimizes and caches expensive computations by implementing path pre-scanning for `Kernel#require` and `ActiveSupport` autoloads, and compilation caching for Ruby bytec. This post further details approaches to identifying and fixing slow code through profiling (using tools like rbspy, stackprof, rack-mini-profiler, and app_profiler) and benchmarking (using Benchmark module, bm, bmbm, and benchmark-ips). It provides case studies on using these techniques to address performance regressions, such as unnecessary GC cycles caused by object allocation issues.