I want to speed up my Heroku app, should I add an extra Dyno or the first Worker?
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.Sign up to join this community
see my response in this post - Dynos do not increase performance
Things have changed a tad bit since this was originally answered. I also think they are missing a vital point:
The different dyno sizes do offer different CPU performance characteristics, and will aid a little in a high-CPU situations, but ideally you should consider offloading work to a background worker as a first step in optimization, as well as optimizing the code.
So to sum it up. If you have only one dyno then you should add another one, or opt to use a 2 x dyno to prevent idle sleeping (and possibly increasing redundancy). Some CPU performance can be obtained through adjusting the dyno sizes, but the main ways to really boost CPU intensive application is through background jobs, architecture, and generally improving code efficiency.
P.S. Sure, you could set up some sort of polling for the app every hour and circumvent this policy that way, but hey let's be fair here - isn't that just cheating? You don't think Heroku deserves some pennies for running your (albeit small, but hopefully nicely working) app? :)
Neither workers nor dynos directly increase your application speed. If your application is slow, it will continue to be slow even if you add more dynos.
Dynos represents concurrent requests. With 1 dyno, Heroku handles 1 concurrent request at time. With 4 dynos, it will handle 4 requests but if a request takes 10 seconds to complete, 4 requests will take 10 seconds each.
Workers can indirectly speed up your application if you start moving heavy and slow processes (like email delivery or .PDF generation) to background tasks.
Generally speaking, the way to increase your application performance is to inspect your application behavior and improve the code. Normally, you might want to use a fast caching layer (like Redis or Memcached) to speed up slow queries or cache view fragments.