How to determine max. not. clients that my web server can work with?

I need to compare the performance of three different computers, each of which starts a web server. My idea is that for the same php script is processed on each server, the one that can serve the largest number. Customers with a given load limit will be the most powerful.

To implement this, I have one PHP script that basically does some heavy math calculations. I maintain the number of clients as a static value. The script will run indefinitely until we say that the processor load is 95%. when the load reaches 95%, the script should stop for all clients. And at this limit one of the best customers will be the best.

The general structure of this php script is as follows:

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:

  • - my approach to the correct comparison of results. (PS should I use benchmarking web interface)?
  • How to determine no. clients connected to my server?
  • Pls provides the best way to find CPU utilization. (It is difficult to make the maximum cpu limit using load_averages, which can be obtained by reading from / proc / loadavg).

Thanx ..

+4
source share
2 answers

Trying to do this from the inside out is less accurate than running an external comparison tool.

Remember that there are several triggers in the php core that can avoid or limit processor consumption.

With the opcode cache, this can work faster, several other aspects.

Check out some tools at: http://www.opensourcetesting.org/performance.php

I firmly believe that PHP is not suitable, and also writes this in a raw memory access language / processor with closer memory and a cpu processor like C.

+1
source

Think it's nice to try. Sounds like a fun project.

Unfortunately, this is not realistic load testing. Configuration settings greatly affect the capacity that a single script can use. You only work with one thread, and web servers are highly dependent on multi-threaded capacity. Other influences, such as active load, other processes, distributions, etc., also affect. Do not even take into account network speeds.

Loads are usually indicated by type 2.0. This actually says nothing about loading, as it depends on the number of processor cores that are your real bandwidth.

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

  • - my approach to the correct comparison of results. (PS should I use only web benchmarking)?
    No, as explained above.

  • How to determine no. clients connected to my server?
    This will only be done if you know what customers are actually doing. A server for delivering only static files must be fully configured compared to a server running a complex script on every request.

  • Pls provides the best way to find CPU utilization. * It is difficult to draw max. cpu limit using load_averages, which can be obtained by reading from /proc/loadavg.*
    In a separate process, record the entire load and register it. Place it next to the test log and you will see the effect. To create this limit, the only way in PHP is the exec command, parse the feedback. Mention the note above about nr. processors, cores, etc. that you need to take care of. This is not just a percentage.

+1
source

Source: https://habr.com/ru/post/1394445/


All Articles