Scaling Websites

Discussion in 'OT Technology' started by Peyomp, Mar 29, 2008.

  1. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    Anyone got a favorite book on growing an apache website to handle oodles of hits?
     
  2. Mint

    Mint Active Member

    Joined:
    Jun 22, 2007
    Messages:
    5,208
    Likes Received:
    0
    Location:
    Southern Cali
    Your question doesn't make much sense to me, can you reword it?

    You want to host a website on an apache server that will have a lot of traffic?

    You want the website to scale with different browsers and resolutions?
     
  3. Doc Brown

    Doc Brown Don't make me make you my hobby

    Joined:
    Mar 31, 2006
    Messages:
    16,404
    Likes Received:
    0
    Location:
    Ohio
  4. Doc Brown

    Doc Brown Don't make me make you my hobby

    Joined:
    Mar 31, 2006
    Messages:
    16,404
    Likes Received:
    0
    Location:
    Ohio
    Oh man, I read that wrong. I thought you said heights, but you meant sites.

    My bad.
     
  5. whup

    whup I wish you had children and.. so that I could step

    Joined:
    Feb 12, 2007
    Messages:
    1,603
    Likes Received:
    0
    If you're scaling a website, the last thing you should be worrying about is the web server.
     
  6. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    not true. Many "large" sites have actually moved away from apache and towards a more simplistic, purpose-built webserver such as lighttpd and have noticed their "slowdown" problems go away.

    That being said, optimizing apache will start with the config files -- and no book is needed for that... just go to apache.org for all that info.

    Further optimization is going to be of your code (depending on what language it's written in) as well as your SQL and DB server(s).
     
  7. crontab

    crontab (uid = 0)

    Joined:
    Nov 14, 2000
    Messages:
    23,458
    Likes Received:
    12
    my previous place just threw more webservers behind the load balancer. when i left, they had about 36.
     
  8. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    Well, I'm talking about high availability as much as scalability: I.E. at a minimum I'll need two apache servers, and 2 mysql servers. The low-DB load of this app probably allows them to be the same server.

    Anyway, what I'm talking about is more the HA aspect, than the efficiency and tuning aspect.

    So I'm talking about clustered/synced and fail-over'd MySQL, and multiple Apache servers. And I'm wondering if anyone has any good resources on analyzing exactly what I need, what the best option is, and how to go about that.
     
  9. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    I found a place that will offer a 2 server setup behind a hardware load balancer for like $750 a month for semi-beefy Xeons. Sound reasonable? I really don't want to deal with co-located hardware, and the nature of this being a startup argues against the up-front cost of purchasing hardware.
     
  10. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    depends. what kinda bandwidth?
     
  11. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
  12. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    Fuck. I can't find it now. Anyone got recommendations?
     
  13. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
  14. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    ThePlanet does not offer or support Ubuntu Linux. So thats out.
     
  15. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    wtf why are you trying to use ubuntu?
     
  16. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    They support CentOS/RHEL and FreeBSD out-of-box.

    you need a debian solution? EV1 used to do debian so they may still facilitate you.
     
  17. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    I found it: http://www.dedicatedservercity.com/load-balanced-servers.html

    That is what I am looking at.

    $477
    # 2 Servers + HW Load Balancer
    # Intel Pentium D 2.8GHz CPU
    # 1024 MB RAM
    # 160GB SATA HDD
    # 4Mbps Unmetered Bandwidth
    # Fedora Core 4 / Win 2003 +$40

    $597
    # 2 Servers + HW Load Balancer
    # 1x Dual-Core Xeon 3.0GHz CPU
    # 1024 MB RAM
    # 2 x 160GB SATA RAID1
    # 4Mbps Unmetered Bandwidth
    # Fedora Core 4 / Win 2003 +$40

    $735
    # 2 Servers + HW Load Balancer
    # 1x Dual-Core Xeon 3.0GHz CPU
    # 1024 MB RAM
    # 2 x 160GB SATA RAID1
    # 4Mbps Unmetered Bandwidth
    # Fedora Core 4 / Win 2003 +$40

    $995
    # (2) Intel Pentium D 2.8GHz CPU
    # (2) 1x Dual-Core Xeon 3.0GHz CPU
    # Hardware Load Balancer
    # 10Mbps Unmetered Bandwidth
    # Fedora Core 4 / Win 2003 +$80
     
  18. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    I use Ubuntu because I am doing my own admin and I don't LIKE doing administration. Ubuntu requires the least administration, so I use it. Seriously, its great. I had a Fedora/CentOS server from ThePlanet before and it took me a whole week just to get my Perl/Catalyst/Apache app to run. It takes literally 5 minutes to get it to run on Ubuntu/Solaris 10/OS X. I don't have time for that shit.
     
  19. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    I talked to them. They run a coyote load balancer, which will verify the up-ness of the web servers before forwarding the request to them, and for $40 a month I can use their fat ass hardware firewall, which would be nice to help avoid DOS.

    I kinda like their solution. I asked them about multiple data-centers, if we wanted super duper up-time, and they don't do that. But thats fine.
     
  20. whup

    whup I wish you had children and.. so that I could step

    Joined:
    Feb 12, 2007
    Messages:
    1,603
    Likes Received:
    0
    Not true; but it's only partly related to this anyway.

    Separating out static content is one of the main steps with scaling a website, and while lighttpd has been very popular for this, some benchmarks have shown that it's not quite the amazing gain as it's been made out to be.

    Optimizing web server config files and the differences between using Apache and Lighttpd (even if those are an option) is going to make minimal differences to the main points:

    * You have to worry about the techniques of scaling and optimizing both client-side and server-side performance
    * Smart caching at multiple levels (database, business objects, partial templates, full pages, resources, AJAX pages)
    * Gzipping text content
    * Optimising your javascript and where it's placed in your page
    * Minifying, compressing and aggregating your scripts
    * Optimizing SQL statements, database structure etc

    There is soooo much it's not even funny. Your webserver is the LAST thing you could ever consider.

    The best thing you can do is profile your server-side using things like XDebug and WinCacheGrind for PHP, dotProfiler for .NET etc. This will tell you were you need to improve things, or where you can make gains if you just want to squeeze out better performance.

    Then UI-side, profile with things like Firebug.

    There's heaps of stuff about scaling and performance out there. The current site I'm working on needs to scale like a son of a bitch so I've been going into a lot of these things in great detail.
     
  21. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    I'm not really asking for help about optimizing my app. That I am familiar with. And, I've deployed my app on both lighttpd and apache. What I'm talking about is spanning an app over multiple servers for high availability. I'm talking about the server/systems component of scaling.

    Specifically: I'm thinking about starting with two apache servers behind a hardware load balancer. I'm still not sure what MySQL configuration I will use.
     
  22. whup

    whup I wish you had children and.. so that I could step

    Joined:
    Feb 12, 2007
    Messages:
    1,603
    Likes Received:
    0
    Perhaps to prevent confusion next time, don't call your thread "Scaling websites" and mention handling "oodles of hits" in your post.

    While they're not mutually exclusive, scalability and load balancing/replication/availability are very different things.

    Why do you need load balanced servers? Is the app running too slow and is too much for one instance of apache? Are you having downtime on that server?

    You should definitely have a replicated instance and load balanced to help with traffic but mostly for availability. But if you've having stability and performance issues, throwing more hardware at the problem is the easy way out and is not a good fix.
     
  23. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    Well, it does need to handle oodles of hits as well, but you're right: high availability and scalability are two different issues. But the essential requirement is: always be up, and be able to respond to large volumes of hits over a short period. I'm asking for references on how to achieve this, and specifically about the systems aspect of achieving this: throwing hardware at the problem. Obviously it will vary, and I'm not asking you to tune my SQL. But someone has probably written a good book on the topic?
     
  24. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
  25. whup

    whup I wish you had children and.. so that I could step

    Joined:
    Feb 12, 2007
    Messages:
    1,603
    Likes Received:
    0
    I can't remember the last I.T. book I bought and read. Everything I look for on the net, especially as it's going to be more current.

    Book looks ok. It seems strange that for a book about scaling that it's got stuff like i18n, source control, xss and sql injection protection, unit testing in there.
     

Share This Page