Am planning to run a chat script on my Apache server and it uses polling every second to receive messages. I know about Comet etc, but I do not want to use them at the current time.

I am wondering if anyone can give me an approximate number of concurrent users it will be able to handle?

Server Specs Ubuntu Server, 256MB RAM, Quad Core

Script basically is a simple chat script which reads from mysql db if there are any new messages, if yes, it returns those messages, else it exits.

Thank you for your time.

  • 3
    With no hardware specs and very little information about the script, there is nothing anyone will be able to tell you... Jun 2, 2009 at 14:14

4 Answers 4


since your apache server can be running on almost everything, ranging from a Nokia Internet Tablet to a fully loaded Sun E25K, and the fetching of messages can be from simply reading lines out of a file up to doing costly database queries, and your apache could be set up (mpm-wise) in a near-to-infinite number of ways; you should either:

  • Provide more detail (and take into account that even then, the largest part will be guesswork)
  • run a benchmark yourself. (carefully design a scenario which matches real life the best you can...)

While the tone might be sarcastic, I do firmly believe the second recommendation to be the best, and am not trying to offend you in any way...


No, nor can anyone else, but I can tell you how to think more clearly about the question.

In some senses, your Apache MaxClients settings is how many concurrent users you can "handle"; likely you'll want to increase it, and the questions there are whether you have enough memory to run that many Apache processes without hitting swap (which, of course, depends on how big a memory footprint your Apache processes actually have under your build and configuration) and whether your machine and the operations it's performing are fast enough that memory is even a worry.

The speed question leads into your polling script's performance: if it takes 0.01 seconds to run, and every user is hitting it once a second, and you have 4 CPUs, then the most people you could theoretically possibly have without jobs starting to wait for each other is 400. (In practice it'll be less than that because the jobs don't come in in a perfectly orderly line, parallelization isn't perfect, and the machine has other things to do too.)

But, y'know, since we have these gracefully degrading systems, that isn't really an important number; the critical thing is how many people it takes to make the system degrade "too much" for your subjective purposes. It it okay if someone hitting your poller waits 0.1 seconds for it to come back? 0.2 seconds? 3 seconds? Somewhere in there is a line where you'll say "okay, no, this performance is too bad". The number of users you have at that point is your capacity.


It's basically a function of available memory - how many threads/processes can you hold?

In your case you really need to measure this, and set MaxClients so that you don't swap, otherwise it's game over.

If you are polling every second you need to decide if you are going to use KeepAlive or not.

You really need to read this and this.


Adding to what chaos said above re: MaxClients. Apache has a hardcoded ceiling of 255, but changing it does require a recompile. Now, recompiling apache is normally pretty straight forward, but you may want to read up on the tools used by your distribution to simplify future upgrades.

Realistically though, if you're hitting 255 children on one server, you're doing something wrong.

  • 255 maxclient on actual production server is already wrong. If you want to use keepalive requests and site is popular (used to maintain a second biggest commercial portal in my country so i do think i have some background on the matter), you dont need 255 actual client connections to run out of "reserves".. This might be somewhat different on A2 and how they new workers actually do work but on apache 1.3, maxclients of 255 on big iron is just waste of hardware.
    – rasjani
    Jul 25, 2009 at 15:41

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