[Thinlinc-technical] negative 'rating' calculation in tl-best-winserver

Jens Langner j.langner at hzdr.de
Fri Aug 2 10:12:52 CEST 2013


Hello ThinLinc team,

since a while now we are heavily using the "tl-best-winserver" functionality in automatically deciding based on the load and memory consumption of a windows server to which server in a group a user should be automatically connected. As you know, with the help of Peter I was also able to create an own version of "tl-best-winserver" with the same calculation scheme so that we can use this tool directly on the client side as well and already decide there which server should be preferred when connecting. Since we are working with this functionality for a while now we found out that the "Rating" values calculated by "tl-best-winserver" sometimes are negative while they should usually ruffly correspond to the number of users a server could still host. 

See here for an example output of the web administration interface for two servers in a group:

-- cut here --
Server	SystemLoad	Mem total (MB)	Mem free (MB)  	Swap total (MB)	Swap free (MB) 	Number of users	Rating
server1 0.620	 	32767.29	23771.48	32765.47	32149.17	13	 	16.0
server2 6.060	 	32767.29	5835.72	 	32765.47	29553.33	47	 	-264.0
-- cut here --

As you can see here, the rating for server2 corresponds to -264 while for server1 it ended up with 16. While watching these numbers we were quite curious why there are negative values at all and did some investigation of the formula you provided to us:

-- cut here --
num_users_mem = (loadinfo.mem_free - loadinfo.swap_used/2) / RAM_PER_USER
free_bogomips = EST_BOGOMIPS * (1 - loadinfo.loadavg)
num_users_load = free_bogomips / BOGOMIPS_PER_USER
num_free_users = min(num_users_mem, num_users_load)
rating = num_free_users - (loadinfo.num_users / EXISTING_USERS_WEIGHT)
-- cut here --

The above is the information provided by Peter Astrand a while ago and by looking at it one could find the following line to be the reason for ending up with negative rating values:

free_bogomips = EST_BOGOMIPS * (1 - loadinfo.loadavg)

Here actually 'loadinfo.loadavg' is assumed to be between 0 and 1 for a system with not too high load. However, for multicore systems like the one above a normal, not too high load is always between 0 and the maximum number of cores. Thus, in our understanding the above equation should be changed to:

free_bogomips = EST_BOGOMIPS * (numcores - loadinfo.loadavg) / numcores

This would then in our understanding calculate negative free_bogomips only for loads higher numcores and would be thus much more appropriate. Now my question is, is this problem known or is there any special reason why tl-best-winserver only considers a loading between 0 – 1 rather than 0 – maxcores?

In our case here we were now able to adapt our tl-best-winserver script because via the check_nrpe command you already get the number of cores of a system and thus can easily change the calculation. Please find the latest version of our tl-best-winserver shell script attached for anyone interested.

best regards,
jens
-- 
Dr. Jens Langner
Helmholtz-Zentrum Dresden-Rossendorf
Institute of Radiopharmaceutical Cancer Research
Department of Positron Emission Tomography
POB 51 01 19, 01314 Dresden, Germany
http://www.hzdr.de/ | +49 351 260 2757

Vorstand: Prof. Dr. Dr. h. c. Roland Sauerbrey
Prof. Dr. Dr. h. c. Peter Joehnk
VR 1693 beim Amtsgericht Dresden

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tl-best-winserver
Type: application/octet-stream
Size: 5776 bytes
Desc: not available
URL: <http://lists.cendio.se/pipermail/thinlinc-technical/attachments/20130802/673420cc/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2345 bytes
Desc: not available
URL: <http://lists.cendio.se/pipermail/thinlinc-technical/attachments/20130802/673420cc/attachment-0004.p7s>


More information about the Thinlinc-technical mailing list