Search code examples
ruby-on-railsnginxunicornhorizontal-scaling

Rails deploy: 4 small servers or 1 big server?


I have $20/m to spend.

DigitalOcean 512MB-1CPU droplet cost $5/m each. A 2GB-2CPUs droplet cost $20/m.

I'm wondering if I should go with:

  • 1 front proxy + 2 app servers + 1 DB server 512MB each
  • 1 server with 2GB + 2CPUs?

Which will output better performance?


Solution

  • 30,000 hits/month = 1000 hits/day = 0.7 hits/min - in this case you can purchase one $5 VPS for beginning and install application (2 Rails workers) and DB to it.

    2 rails workers will take about 100-200 MB per worker (400-500MB for big project, but this is not your case). DB will take about 50-100MB. Typical workload will be less 10%, so 1 CPU will works fine.

    In case if you will have more hits just use vertical scalability (i.e. upgrade your one instance).

    So, for beginning your choose is one $5 or $10 VPS.

    P.S. I am hosting similar project on one $5 VPS in configuration described above. Typical RPM (requests per min) is about 70-120. All works fine.