I've deployed a rails app 3.2.22.2 running on ruby 2.2.0p0 on heroku with puma as web server.
Heroku loves puma and advice new apps to use it:
Puma uses threads, in addition to worker processes, to make more use of available CPU. You can only utilize threads in Puma if your entire code-base is thread safe. Otherwise, you can still use Puma, but must only scale out through worker processes.
I can't ensure my rails app (my code in fact) and the gems are threadsafe, so my only option is to add some workers and configure my Procfile like this:
web: bundle exec puma -t 1:1 -p ${PORT:-3000} -e ${RACK_ENV:-development}
worker: bundle exec rake jobs:work
Just in case, I've also set the config vars as:
=== myapp-staging Config Vars
DATABASE_URL: http://postgresthis:that@addresse:port/more
LANG: en_US.UTF-8
MIN_THREADS: 1
NEW_RELIC_LICENSE_KEY: key
NEW_RELIC_LOG: stdout
PAPERTRAIL_API_TOKEN: key
RACK_ENV: staging
RAILS_ENV: staging
RAILS_MAX_THREADS: 1
SENSIBLE_DEFAULTS: enabled
WEBSOLR_URL: http://ift.tt/235Mbhj
WEB_CONCURRENCY: 1
So... if I can only use only 1 thread, is puma the right solution for my app?
Thank you!
ps: please have a look at that question What configuration for Rails 3.2.22.2 + Puma + Heroku?
Aucun commentaire:
Enregistrer un commentaire