There are two (number in the future will grow) of the server on which to spin the same web project, code is the same, the axis is CentOS. Iron server differ, the first — 2-core with 4 gigs operatives, the second a 4-core with 8 gigs operatives.
At the entrance have a bunch of users each server load, and different — someone more, someone less than 10 minutes ago, so, now that; you can add a new user, which will create a very heavy load and so on. Statistics are available all this. The aim is to spread users across servers so that the workload of these servers was more or less the same. As the user loads the server, to reallocate the users for the necessary servers every 10-20 minutes.
To distribute the data necessary for the utilization of servers. To them it is necessary means php or the operating system in the form of percentages, they say the average workload of server 1 for the last 15 minutes = 85%. With php you can obtain using the function
sys_getloadavg, however, the resulting value is "the number of processes in the system run queue", and, as I understand it, it has a maximum value, i.e. the percentage utilization of to Express does not, which is impossible to determine the conventional "capacity" of each server — the maximum number of users which can be sent to a particular server. There is an option to write to a log or Menkes data from the top, but it will have to do very often (every second?) in order to obtain the most reliable data, load it jumps. In General, hepatovirus, Your suggestions =)