7

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?

1
  • Thanks for the link. From phone I couldn't do it Commented Mar 6, 2009 at 17:35

3 Answers 3

9

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.

1
  • very interesting approach! Do you know where I could go to find more practical tips like this? Commented Mar 31, 2009 at 0:58
2

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

2
  • 1
    Good information, and I like thttpd a lot (I've used it a couple of times in the last 8 years). Important to note though, that the table of info you list is more than ten years old. Commented Nov 10, 2009 at 18:19
  • 1
    That page says "last updated in 1998" ... has anyone done any similar banchmarks since then? Commented Mar 24, 2012 at 13:26
1

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.

2
  • 1
    you might want to tone down the language a bit - that tends to attract flags etc. And an automatically-deleted answer doeesn't help the OP or do justice to your time in answering it. Commented May 26, 2011 at 12:23
  • use low tcp and keepalive timeout values and you will not have this problem. anyway, you will have same problem on other servers, before packets will reach it :)
    – GioMac
    Commented Oct 25, 2012 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.