DEV Community

Vladislav Kopylov
Vladislav Kopylov

Posted on • Edited on

1

Why Ruby app deploy is getting progressively slower

I have a big and stable Rails application which has been running in production for 5 years. Each time I deploy the code using Capistrano and I've noticed that deploying time is getting slower. It takes 5 minutes longer than we are used to. Looking through the logs, I've noticed that the task bundle exec rake db:migrate takes 5 minutes. It was unusual!

I've done some manipulations with a deploy script. I noticed that due to the creation of new release, the first run bundle exec <COMMAND> is terribly slow. I was shocked. I had idea that there is something with code initializing or with caching.

I use Bootsnap for each my Rails application and I've noticed one thing:

Note also that Bootsnap will never clean up its own cache: this is left up to you. 
Depending on your deployment strategy, you may need to periodically purge tmp/cache/bootsnap*. 
If you notice deploys getting progressively slower, this is almost certainly the cause.
Enter fullscreen mode Exit fullscreen mode

Yes, it was the answer! After some years of using Bootsnap on the server it has written caches for 180 Mbs. I have deleted all cache files using rm tmp/cache/bootsnap* and It helps me. Be aware, if you are using Bootsnap and your application is getting slower on the boost, maybe there is a problem with a large amount of cache.

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay