DEV Community

Jonas Brømsø
Jonas Brømsø

Posted on

Calculating Allowed Downtime for Human Consumption - 99% to 99.99999% Availability

Some weekends ago I read a LinkedIn post on the subject of calculting allowed downtime, but turning the calculation around from your downtime you could instead look at what you tolerance was in regard to how much allowed downtime you would actually have. So I decided to implement this in Go, just for the fun of it.

As I got the first iteration completed I could see that my calculations did not match the ones from the post. I know I am not strong at math, but I wanted to check with another resource so I started to look around found and uptime.is, which did made matters worse.

Below is a comparison of the numbers I have calculated and the numbers from the LinkedIn post and uptime.is.

All of the examples are based on the year 2025 - a year with 365 days.

99% Availability: Calculated allowed downtime

Here we all really disagree

Source Days Hours Minutes Seconds
LinkedIn 3 15 39 29
uptime.is 3 14 56 18
mine 3 15 36 0

99.9% Availability: Calculated allowed downtime

Here we all disagree, but we are closer

Source Days Hours Minutes Seconds
LinkedIn 0 8 45 56
uptime.is 0 8 41 38
mine 0 8 45 35

99.99% Availability: Calculated allowed downtime

Here we all disagree, but we are even closer

Source Days Hours Minutes Seconds
LinkedIn 0 0 52 35
uptime.is 0 0 52 9.8
mine 0 0 52 33

99.999% Availability: Calculated allowed downtime

Linked post and I agree on this one, but not with uptime.is

Source Days Hours Minutes Seconds
LinkedIn 0 0 5 15
uptime.is 0 0 5 13
mine 0 0 5 15

99.9999% Availability: Calculated allowed downtime

All is good

Source Days Hours Minutes Seconds
LinkedIn 0 0 0 31
uptime.is 0 0 0 31
mine 0 0 0 31

99.99999% Availability: Calculated allowed downtime

Minor descrepancy where uptime.is has an extra 0.1 second

Source Days Hours Minutes Seconds
LinkedIn 0 0 0 3
uptime.is 0 0 0 3.1
mine 0 0 0 3

Wrap-up

I must admit that I am a bit puzzled, I have not been able to find any explanation on the discrepancies - I would suspect myself to be the one with the error, but I have not been able to find pin-point the bug.

My implementation is available on GitHub and the numbers have been lifted from the repository documentation.

My own implementation supports both leap years and non-leap years, since I wanted to make sure that this was not the issue.

I am very open to a review of my implementation and any sort of explanation on the discrepancies, I am not strong at math, but I see this as a chance to learn and the worst thing that can happen is that I have to update my implementation.

If you have an implementation, please throw me a reference and I am able to do a comparison and if you have more Go experience than me, pointers to improvements are also very welcome.

Nothing like a small weekend morning challenge, taking you down a rabbit hole.

Top comments (0)