Skip to content

Allow giving work to monitors without prior scores#9

Open
avijc wants to merge 1 commit intontppool:mainfrom
avijc:main
Open

Allow giving work to monitors without prior scores#9
avijc wants to merge 1 commit intontppool:mainfrom
avijc:main

Conversation

@avijc
Copy link
Copy Markdown

@avijc avijc commented Nov 14, 2025

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.

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.
@abh
Copy link
Copy Markdown
Member

abh commented Apr 14, 2026

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.

@avijc
Copy link
Copy Markdown
Author

avijc commented Apr 14, 2026

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
fihel3-1spwqxm 17.1
fihel4-1spwqxm 22.8
nlams1-1spwqxm 9.5
phmnl1-1spwqxm 0.5
plwaw1-1spwqxm 1.4
sgsin3-1spwqxm 13.7
sgsin4-1spwqxm 2.4
usmdw1-1spwqxm 36.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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants