Created
December 16, 2022 22:50
-
-
Save iamricks/22ce4b05637a364f4b384b8acdd6fd67 to your computer and use it in GitHub Desktop.
Endpoint Faliure Rate Calculator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script helps calculate the total number of requests given a failure rate | |
# Example: 1,000,000 requests with a 33% failure rate will result in 492,536 retries | |
# This means it would take 1,492,536 requests to update 1M objects in an endpoint | |
# that has a 33% failure rate. | |
total_retries = 0 | |
requests = 1_000_000 | |
faliure_rate = 0.33 | |
attempt = 1 | |
while requests > 3 do | |
retries = requests * faliure_rate | |
requests = retries | |
total_retries += retries | |
puts "On the #{attempt} attempt, #{(retries).to_i} will be retried!" | |
attempt += 1 | |
end | |
puts "Total retries: #{total_retries.to_i}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This can help you calculate the needed throughput for an endpoint given an average failure rate.