I tried so many ways to kick out lethargy in me and force me to blog. This is one more thought that I had. Every day I would think / learn / understand about 5 new things and blog about those 5 new things.. See if this initiative I can make it into a habit.
Mathematical thought “why in a distributed system there will always be a definite failure of at the least one system but very remote chances for entire system failure”
It always intrigued me when in documentation / presentation it is mentioned “In a highly distributed systems, there is / are always failed single or multiple systems somewhere but entire solution should withstand such failures”. Today I read it again in documentation of Redis, so instead of going through document, I digressed on what it meant and finally came up with below answer :).
Assume an unreliable system, that keeps failing frequently. Now someone asks question “Will it fail tomorrow?”. Answer would be probably but not sure. Mathematically it implies that there is 50% (1/2) chance that system will fail and same chance that it will not fail.
P(Failure) = 1/2 and P(Not Failure) = 1/2
To increase reliability we add one more system with same reliability i.e, even for second system
P(Failure) = 1/2 and P(Not Failure) = 1/2
Assuming these two systems are independent of each other:
- Probability that both systems fail at same time = P(Failure (A)) and P(Failure (B)) = 1/2 * 1/2 = 1/4 = 25%.
- Probability that either of system fail = P(Failure (A)) or P(Failure (B)) = 1/2 + 1/2 = 1 = 100% :).
Now assume if we have 10s of such unreliable system then
- Probability of all system fail at same time = 1/(2^10) = .1% (failure) ie 99.9% System as a whole would be available.
- Probability of atleast one system failure = 1/2 + 1/2 + 1/2……1/2 > 1. Implies there would be a definite failure of atleast one system.
Admittedly this is a very novice understanding and there could be more complexities involved in real world computations like conditional probability, but this atleast for new suffices as an answer to question that I always left me wondering..
May be if I can expand further, if we give x as reliability of individual systems (by prediction) and required reliability from entire systems, may be such a computation can be reversed engineered to some meaningful calculations..
Till my next learning…
In a class of 50, I had this bet.. There will be atleast 2 people in class who share same birth date(date and month only and not year).
To clarify, person A with DOB 1st January 1999 shares birth day with person X with DOB 1st January 1965. Years can be different but dates and months are same.
What is probability that such an event might or might not occur?
Before arriving solution to above problem, brief basics of probability..
P(Event) = Count of events that meet condition / Total number Events.
First person has already chosen a DOB, assuming, in class all of them have different DOB, then there are only 364 days remaining. So probability of second person is 364/365
As each person DOB is independent,
Combined Probability: 1×364/365…………316/365 = 0.029626
That implies there is 0.029626 = 0.03 or 3% chances that 2 persons do not share same DOB. Conversely 1-0.29626 = .97034 = 97.034% that there will be atleast 2 persons sharing same DOB.
Find surprising.. try it out..
Until next time..
During recent session in Intro slide I put my entire phone number except last three digits. It is stupid to do that.. may be or may be not..
Phone number is a 10 digit number with each digit ranging from 0-9. For example if my phone number is 3021067894 then
- Each position of phone number can vary from 0-9
- And every position is independent of other position. Example 3 at first position is not dependent upon 0 at second position.
Now coming to solve “Guessing Phone Number Problem”, for each position, from total 10 numbers only 1 can be selected. So probability of selecting a number from total ten number is 1/10. And since each position is independent of every other position we have (1/10)*(1/10)…
As I revealed 7 digits of my 10 digit phone number only 3 positions have to be guessed, simple right??
Total number of combinations: (10)*(10)*(10) = 1000 and
In that only 1 number is correct = 1.
So, likely chances of getting correct number (IN FIRST TRY) is 1/1000 = 0.001 or conversely 1-0.001 = .999.
That implies 99.9% times people still will not be able to find my number .
Me being stupid:
Assumption here is only 1 try what if someone writes a loop and puts all numbers together, then probability he has my number is 1 (Certain).
May be it not that stupid after all…
- I am not a celebrity for people to search for my number spending their valuable time
- Even if they write a loop to get my correct numbers, what is feedback mechanism to check if they have right number or if I have given first 7 digits right . May be call all numbers or may be use Machine Learning to guess my numbers…
Until next guess….