Hi, On Mon, Oct 19, 2009 at 06:10:24PM +0300, Balcoes wrote: > Hi. This discussion got me thinking would it be possible for HAproxy to query > a PHP/Perl/Python...-script that returns some kind of numerical information > concerning the server's load. For example HAproxy could check periodically > http://server_name/load_status > where the 'load_status'-script would return something like > performance_index 0.92 > Ideally the performance_index should be 1.00, but under heavy load the index > would be lower. HAproxy could then multiply the basic server weight with this > performance_index. > > For example there could be three servers > server Aserver 192.168.0.1:80 cookie Acookie check inter 2000 > weight 100 > server Bserver 192.168.0.2:80 cookie Bcookie check inter 2000 > weight 100 > server Cserver 192.168.0.3:80 cookie Ccookie check inter 2000 > weight 80 > > If all servers are working optimally under light load all of them would > return a performance_index of 1.00. However if server A should be under heavy > load, it would return performance_index 0.5. The server B is somewhat less > loaded returning performance_index 0.8 and C lightly loaded returning 0.95 > the dynamic weights would be > server A: 100 * 0.5 = 50 > server B: 100 * 0.8 = 80 > server C: 80 * 0.95 = 76 > > The beauty is that every administrator could tweak the 'load_status'-script > at his/her heart's will taking into consideration just his/hers own server > farm's typical use and properties by choosing what performance data (CPU > usage, CPU load, io_wait, average/maximum response time...) he/she wants to > use when calculating the performance_index. > > Best, B
This is exactly what was planned when the dynamic weights were implementated in 1.3.15, but finally there was a choice of the customer not to use them that way because of possible disagreements between the people in charge of the servers and the people in charge of the LB in case of issues caused by an unbalanced farm. The most basic principle simply is to check the idle CPU ratio, but then you can announce whatever you want. Also, don't forget that you don't want a value from the server to be immediately turned into a weight. A weight only has a meaning compared to other weights. So you want to adjust each server's weight relative to its available capacity vs global capacity, and its weight vs total weight. It's indeed useless and even undesirable to adjust weights when servers are properly balanced and their load varies homogeneously. Willy

