[LRUG] Rails Application boot times?

James Hunt ohthatjames at gmail.com
Fri Feb 7 12:56:07 PST 2025


Is the 2m30s for dev or production? If it's dev then is `config.eager_load`
true? That might be adding a lot of unnecessary overhead for local
development. Sometimes older apps have  this turned on for esoteric loading
or reloading issues, but dealing with this has improved a lot in newer
versions of Rails so it may be feasible to fix older issues now.

One rough and ready way of finding startup bottlenecks is to add this to
the top of `config/boot.rb` to see what takes more than 0.5s to load, then
you can fix those and ratchet down the time:

```
def require(file)
  t = Time.now.to_f
  result = super
  total = Time.now.to_f - t
  puts “Require #{file} took #{total} seconds” if total > 0.5
  result
end
```

James



On Thu, Feb 6, 2025 at 2:03 PM Edmond Lepedus <ed.lepedus at googlemail.com>
wrote:

> Hey LRUG,
>
> Can I get a feel as to whether a 2m30s boot time for a Rails app with
> ~550,000 LOC is reasonable? Rspec startup time is also >1m.
>
> Having mostly worked with other stacks, it feels excessive, but maybe my
> spidey-sense is warped?
>
> Please help!
>
> Thanks in advance,
> Ed
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20250207/464475ae/attachment.htm>


More information about the Chat mailing list