Allow giving work to monitors without prior scores#9
Allow giving work to monitors without prior scores#9avijc wants to merge 1 commit intontppool:mainfrom
Conversation
GetServers is used for selecting which monitor servers are assigned to check an NTP server. Due to the current SQL query, a monitor can only be selected to check an NTP server if there is already a prior measurement. This change lifts this restriction.
|
I didn't merge this because I was worried it'd make the query execution much slower; and haven't had time to test it. The system inserts entries in server_scores when a new server OR a new monitor is added/activated, so it should be reasonably in sync. It also makes that table particularly large and busy; it's probably not a great design -- depending on how it works in the Postgres refactor it might need a redesign. |
|
I'd think the various OR conditions would cause more performance issues than this moving one condition into a left join part. At least at some point MySQL was notoriously bad at optimizing such queries, forcing the query to be rewritten as a series of UNIONed queries that only used AND. Maybe the situation has improved since then. That said, on my testbench setup with MariaDB the two queries do use a different query execution plan. With just a few rows of data in each of my test tables it's hard to measure the performance impact. Maybe the optimization will need to be postponed to the Postgres stage. But as for inserting the entries -- yes, it seems that server_scores rows get added when a new NTP server is added, but when a new monitor gets added it does not seem to get "empty" server_scores rows for all the NTP servers. This would not matter if the SQL query was changed according to this pull request. I described the symptoms on the discussion forum some months ago, and it seems that the situation has not changed. The example pool NTP server still does not list my monitor nlams1-1spwqxm that I added in August last year. These are the 24h tests/min numbers for my monitors in the beta system: ausyd3-1spwqxm 9.1 phmnl1 is the newest addition, but it too has been active for some four months now. I'd expect sgsin3 and sgsin4 (newer) to have around the same number of tests/minute, and I'd expect nlams1 and plwav1 to have more traffic as well. I understand that there are regional differences (varying ratio of servers/monitors), but still. |
GetServers is used for selecting which NTP servers are assigned to be checked by a monitor server. Due to the current SQL query, only those NTP servers which have a prior measurement from a particular monitor can be selected. This change lifts this restriction.