logo logo

May 16, 2020 13:28

Heroku Tips

How to reduce the slug size in your heroku app

Compressing the size of the slug files, you can improve the performance of your app

how to confirm the slug size of your heroku app

  • In heroku dashboard > Your app > Settings > App Information
  • You can also find it in the messages displayed after the each deploy in console

And how?

  1. Install the heroku-repo plugin
$ heroku plugins:install heroku-repo
  1. Utilize this to tool by the following commands
$ heroku repo:gc --app your-app-name
$ heroku repo:purge_cache --app your-app-name

Although if you've already specified your heroku app with the git, you can omit the --app arguments, your-app-name should be changed depending on your situation.

After these command, deploy your app with $ git push heroku so that you can check the reduced size of the total app.
In my case, I could compress the size of my app from 300M to 150M or so.