Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache and the c10k

Tags:

apache

c10k

How is Apache in respect to handling the c10k problem under normal conditions ? Say while running very small scripts with little data, or do I need to scale out if I use Apache?

In the background heavy lifting is done by a few servers running specialized software that processes the requests but I'd like to use Apache as a front. Is this a viable plan?

like image 451
Robert Gould Avatar asked Mar 06 '09 16:03

Robert Gould


3 Answers

I consider Apache to be more of an origin server - running something like mod_php or mod_perl to generate the content and being smart about routing to the appropriate system.

If you are getting thousands of concurrent hits to the front of your site, with a mix of types of data (static and dynamic) being returned, you may find it useful to put a more optimised system in front of it though.

The classic post-optimisation problem with Apache isn't generating the dynamic content (or at least, that can be optimised for early in the process), but simply waiting for a slow client to be able to receive the bytes that are being sent. It can therefore be a significant advantage to put a reverse proxy, in the form of Squid or Nginx, in front of the servers to take over the 'spoon-feeding' of the slow network clients, while allowing the content production to happen at full speed, and at local network speeds - 100Mb/sec or even gigabit speeds - if it even has to traverse a network at all.

like image 124
Alister Bulman Avatar answered Oct 16 '22 23:10

Alister Bulman


I'm assuming you've probably seen this data, but if not, it might give you some idea.

like image 32
MarkusQ Avatar answered Oct 16 '22 23:10

MarkusQ


Guys, imagine that you are running web server with 10K connections (simultaneous). How could it be?

  • You've got many many connections per second

    • Dynamic content

      Are you sure that your CPU can handle that many PHP sessions for example? I guess no, so why are you thinking about C10K problem? :D

    • Static content - small files

      And still soo many connections? On single server? Probably you've got problems with networking/throughput too or you are future competitor of Google. Use lighttpd which addresses C10K problem and is stable - fly light. Using Apache for only static files for large sites is obvious.

  • Your clients are downloading large files for a large time - static content

    • ISO images, archives etc

      If you are doing it via web server - FTP may be more appropriate.

    • Video streaming

      Use lighttpd or specialized software. And still... What about other resources?

I am using Linux Virtual Server as load balancer in front of apache servers (with specific patches for LVS-NAT) and I am happy :) This string is an answer you want to hear.

like image 34
GioMac Avatar answered Oct 17 '22 00:10

GioMac