PrivateBin / Directory

Rust based directory application to collect list of federated instances
https://privatebin.info/directory/
Other
25 stars 8 forks source link

Show more digits (higher precicion) for uptime #16

Closed rugk closed 3 years ago

rugk commented 3 years ago

On https://privatebin.info/directory/ nearly all servers do have a 100% uptime. Only some have 99%.

IMHO this is hardly useful and I guess some servers may have an uptime of 99.8% or so, which is a big difference to 100%. See https://uptime.is/ for a quite handy calculator I've just discovered when writing this issue…

Proposed solution

Display 99.99% i.e. numbers with two decimals places, at least. That is more accurate and provides more information. :smiley:

elrido commented 3 years ago

On https://privatebin.info/directory/ nearly all servers do have a 100% uptime. Only some have 99%.

It actually fluctuates quite a bit. At the time of writing this, we have 5 instances with 98%, none with 99% and one with 50%.

IMHO this is hardly useful and I guess some servers may have an uptime of 99.8% or so, which is a big difference to 100%.

The point of this value is, first, to provide the directory a mechanism to prune instance that become unavailable. Secondly it provides an indication if a certain instance should be avoided. But downtimes can happen (the directory might be down as well) and so it should also not chastise you for too long and track downtimes over years of time with a lower ranking, just provide the user some feedback on what to expect. Third, we order the instances based on these values.

If it is not useful to the user, then we can hide the column, but I would argue that it is more transparent to display the reason why an instance is lower on the list when other criteria make it look OK.

Display 99.99%

At this time we have exact 1% precision. I choose the 25h and 4 times per hour measurements, so the we keep having a sliding window of 100 measurements and therefore I can give you a 99 or 100 percent value, but not anything in between percentages.

For these 99.x statements in terms of availability for SLA's, you would need to measure much more (every 15 - 60s) and over a much longer time (several years) and over many different uplinks in different locations (as the measuring host/uplink might be down as well). Only then can you make such bold claims of having a host with 99.99% availability. The 15 min gap we use means that we only capture the larger downtimes and not even all of those. But when an instance gets turned off, it will disappear from the list within one or two days (the pruning is launched only once per day - on the first day it might not have fallen to <= 10% uptime).

The goal with that choice is that I don't want to poll the instances too frequently, to keep the load and traffic of the directory instance in balance with the utility this check provides. The instance maintainers would probably also prefer not to see to many polls, even if they use only the minimal HEAD requests. Most instances are very small setups, I assume. Also I wanted to keep the SQLite database and in memory caches of these queries as small as possible. At the moment the DB is around a quarter MiB. More measurements would grow the memory footprint and the DB file.

We can discuss if we want longer monitoring periods (more measurements to store in the database) and what tradeoffs these give us. We can adjust these at: https://github.com/PrivateBin/Directory/blob/1611c7c2557e1c3a9eb27c0640f591f75c8825aa/src/main.rs#L36-L38

For support of decimal numbers in the display, we would need to change a number of things: https://github.com/PrivateBin/Directory/blob/1611c7c2557e1c3a9eb27c0640f591f75c8825aa/src/models.rs#L53 The field for storing the uptime value needs to be changed to a different type (or we internally store these as integers and slide the comma by two digits upon display, then an i64 would be sufficient). https://github.com/PrivateBin/Directory/blob/1611c7c2557e1c3a9eb27c0640f591f75c8825aa/src/main.rs#L110 This is where the number is formatted for display: https://github.com/PrivateBin/Directory/blob/1611c7c2557e1c3a9eb27c0640f591f75c8825aa/src/main.rs#L543 This is the query that does the calculation - it may have to be adjusted as well, depending how we want to store and display these.

rugk commented 3 years ago

Okay okay, did not know this details. Given that, I'm personally also not interesting in changing this anymore.