brandonhilkert / sucker_punch

Sucker Punch is a Ruby asynchronous processing library using concurrent-ruby, heavily influenced by Sidekiq and girl_friday.
MIT License
2.65k stars 114 forks source link

Memory issue on Heroku #190

Closed yoshie902a closed 7 years ago

yoshie902a commented 7 years ago

I have a very simple Rails 4 app, with Ruby 2.3.3

I added: gem 'sucker_punch'

setup the adapter: config.active_job.queue_adapter = :sucker_punch

and call: QuoteMailer.request_confirmation(@quote).deliver_later

When I upload to Heroku, my app works until it adds a job to send an email. Then I get an R14 error. 2016-12-30T16:42:19.223766+00:00 heroku[web.1]: Process running mem=641M(125.2%) 2016-12-30T16:42:19.223766+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)

Any ideas?

brandonhilkert commented 7 years ago

What is the memory before adding the email? What is the memory after adding the email?

I don't think it's uncommon for Sucker Punch to use some memory given you're trying to do a bunch of work in the same process as the web process. My experience with Heroku has been that it's very easy to go over the 500M with a Rails app in general that doesn't do much, even if you're pretty conscious of memory usage and avoid leaks.

The underlying library, concurrent-ruby is pretty well battle-tested on a variety of VMs, so I suppose it's possible there's a leak there, but probably highly unlikely.