tnx123456
tnx123456

Reputation: 125

How to determine the max. no. of clients that my web server can handle?

i need to compare performance of 3 different computers each running a web server. My idea is that given same php script to process on each server, the one able to serve largest no. of clients at given load limit will be the most powerful one.

To implement this, i have a single php script which basically does some heavy maths calculations. I am maintaining clients count as a static value. The script will run infinitely until say the cpu load is 95%. when the load reaches 95% the script should stop for all clients. And at this limit, the one system having largest clients count will be the best performer.

A general structure of this php script is as :

static $clients_count=0;
static $sys_load=0;

//increment clients_count
$clients_count++;

while(sys_load<=95)
{
do_heavy_maths();

//calculate current cpu load 
sys_load=get_cpu_load();
}

echo "No. of max. clients this server handled: $clients_count";

So now i have a few questions :

  1. is my approach of comparing CPU peformances correct . (PS i have to use web based benchmarking only) ?
  2. How to determine the no. of clients connected to my server ?
  3. Pls provide a better way to find cpu load. (It's hard to draw a max. cpu limit using load_averages that one can get by reading from /proc/loadavg).

Thanx..

Upvotes: 4

Views: 2534

Answers (2)

Guilherme Viebig
Guilherme Viebig

Reputation: 6930

Trying to do this from inside, is less accurate than running an external benchmarking tool.

Remember that php core has several triggers that can avoid cpu consumption or limit it.

With opcode cache this can run faster, several other aspects.

Check some tools at: https://web.archive.org/web/20140101114848/http://www.opensourcetesting.org/performance.php

I strongly believe PHP does not suit as well as writing that on a raw memory/cpu access language with a closer memory and cpu management like C.

Upvotes: 1

Luc Franken
Luc Franken

Reputation: 3014

Think it is nice to try. Sounds like a fun project.

Unfortunately but this is not realistic load testing. Configuration settings will heavily influence the capacity a single script can use. You are only running single threaded while webservers strongly rely on multi-threaded capacity. Also other influences like the active load, other processes, allocations etc. all influence. Not even to take in account network speeds.

Loads are normally indicated as a number like 2.0. This actually doesn't say anything about the load since it depends on the number of CPU cores which is your real capacity.

For real benchmarking use real tools like: http://httpd.apache.org/docs/2.0/programs/ab.html and many other professional solutions.

  1. is my approach of comparing CPU peformances correct . (PS i have to use web based benchmarking only) ?
    No, as explained above.

  2. How to determine the no. of clients connected to my server ?
    That will only be done if you know what the clients actually do. A server for delivering only static files should be setup totally different compared to a server running complex script at every request.

  3. Pls provide a better way to find cpu load. *It's hard to draw a max. cpu limit using load_averages that one can get by reading from /proc/loadavg.*
    In a seperate process log the over-all load and log it. Put it next to your testing log and you see the influences. To create this limit the only way in PHP is exec a command, parse the feedback. Mention the note above about nr. of CPU's, cores etc. of which you have to take care of. It is not just a percentage.

Upvotes: 1

Related Questions