0

Our new app has received a lot of press today, and is getting thousands of new users every hour... but it has become so slow that it's unusable.

We're using Rails 3 patched to latest, ubuntu, Unicorn, nginx, postgresql, memcache.

I have already added 8 new servers and it has barely made a difference. I have also tried setting the keepalive value of nginx to 1. Other than add more servers I'm at a loss of what to do to improve response times. I have 10 unicorn workers running per server. The issue seems to be that the request queue is just too long on each server. I could be wrong about this, I'm not totally sure what is causing it, I just know that it was working perfectly yesterday at 2% of the current load.

Any help is greatly appreciated

2 Answers2

5

When an app gets slammed there's usually only one thing to do in the short term. Throw money at the problem. Also known as keep adding servers.

In the medium term tune and tweak the settings.

In the long term, fix all that crappy code that's there that didn't need to be fixed before. It's time to pay off that technical debt.

mrdenny
  • 27,074
  • 4
  • 40
  • 68
0

If your app is already doing caching headers properly (ie, dynamic pages which are often visited and rarely updated get given caching headers), sticking Varnish in front of the web server can do wonders.

(On one of my own sites we got a ~10x performance boost, because 90% of the site's visitors are read-only, and they don't mind seeing 10-minute-old cached versions of dynamic pages)

Shish
  • 1,495
  • 9
  • 12