samedi 30 avril 2016

What configuration for Rails 3.2.22.2 + Puma + Heroku?

I've read Richard Schneeman's article, and a bunch of other ones. ;-) I'm still struggling with this.

Here's few gems I've added in my Gemfile to benchmark my app:

gem 'airbrake'
gem 'newrelic_rpm'
gem 'stackprof'
gem 'derailed', group: :development
gem 'rack-mini-profiler'
gem 'flamegraph'
gem 'memory_profiler'
gem "skylight"

After a lots of benchmarks in development and in staging env, I know where my app is not fast enough but there's not memory leak (some small mem bloats sometimes maybe).

newapp-staging app is the new version (aka: new frontend, upgraded gems, optimized queries, ...) of oldapp-production app. Please have a look at the screenshots (oldapp-production use webrick, newapp-staging use puma)

So here comes 2 simple questions:

question #1

newapp-staging app is using ruby '2.2.0' & rails '3.2.22.2' and I can't ensure that it is threadsafe because of my code and the associated gems, so... I must use 1 thread at a time. Is puma an advantage here? Metrics are telling me not. OR... my configuration is not good. (missing preload_app! maybe, or other things?) Here's my Procfile:

web: bundle exec puma -t 1:1 -p ${PORT:-3000} -e ${RACK_ENV:-development}
worker: bundle exec rake jobs:work

question #2

Unicorn could be used as a replacement?

Thank you for your time and your advices.

Cheers

OLD APP NEW APP

Aucun commentaire:

Enregistrer un commentaire