Thursday, February 3, 2011

Does multipurpose node is a good thing for scaling?

I have a web app with different tiers:

  • database for persistence
  • a couple of web servers(mongrels)
  • load balancer

Now it is all running on the same host. But how can I add another server to handle higher load?

Should I separate roles (db & web) before scaling out any further?

P.S. let's simplify the question and ignore High-Availability issues in this question.

P.P.S. database is not a bottleneck right now. I really want to add more web servers, please help

  • Now it is all running on the same host

    Stupid idea, or? I mean - what the heck does a LOAD BALANCER do in the list if there is only one host to start with? This is the one item that makes absolutely no sense to me.

    • Separate roles first. Esepcially as the requirements are vastly different (larger DB needs a lot more IOPS which means many discs).

    • Then reprogram so that multiple web servers can easily coexist.

    • Finally add a load balancer if needed, or use DNS round robin.

    Jesper Mortensen : @TomTom: Mongrel is a process based Ruby application server. It is common best practice in the Ruby world to place a fast HTTP server (nginx, Apache) in front of several Mongrels to add lightweight connection handling and fast static file serving.
    From TomTom
  • For security and performance, I would be inclined to push the incoming http handling into a presentation tier (1 or more servers). Static content can be served in the presentation tier. Also your database / business logic is less exposed to attacks.

    From Gregor
  • @gotts: The canonical way of scaling out small websites looks something like this:

    First: Split to 2 servers, one that runs your HTTP server & web application code (webapp), and one for your database. The database server should be optimized for database workloads, i.e. lots of RAM, fast disk I/O, fast CPU.

    Then: Offload static file serving from the webapp server, either to a different server, or to a Content Delivery Network. Consider disabling HTTP KeepAlive on the webapp server.

    Then: Move to a setup with at least 4 servers:

    • One HTTP load balancer at the front, using consistent hashing based on source IP address.
    • Behind the HTTP load balancer, 2 webapp servers.
    • Behind the webapps, 1 Database server.

    This presentation by Brad Fitzpatrick shows a typical progression on its first pages. If all this is new to you, perhaps you should consider hiring a sysadmin who has done this before... :-)

0 comments:

Post a Comment