Thursday 20 May 2010

Thumb Rule : Multiply by 1000


This rule I made up after few weeks of working in Cloud Computing Environment, Google AppEngine to be more specific. And later after that i started to apply this rule in a more general manner to test a lot of things' effects on us, our environment and system.

Okay so the Multiply by 1000 rule stated formally is "A solution is good if and only if it works equally well when we multiply the situation by 1000". Well this is too simple to be explained further, so i will start up with examples.

So, the idea occurred to me while i was studying the Shard Counter Article. The article deals with the simple problem of keeping a counter that increments itself on every page load. The approach of keeping one counter and increment it everytime is good and simple. Now consider the fact when the web page becomes too popular and the requests are like 100s in every second. Clearly this would over burden the server and a loss in performance is expected. Instead we come up with a new idea of keeping N numbers of counters, and upon page load update any one of it. Later using the associative property of addition, we can find the total number of page loads.

In the Big-Oh notation, we can say that ideally a solution is good if it goes O(n).

Now let's consider some other situations where this rule fits in.

Usage of fossil fuels:
When the fossil fuels were first discovered, they became quite popular in very short amount of time. The then engineers and scientists might have worked upon it's ill effects on our environment but certainly it was over looked. And then the whole human race started sing it for day to day life - electricity, industries, motor-vehicles.. you name it, we have it. So, looking at the present situation it can certainly be said that using fossil fuels to generate energy was certainly not a good solution.

There are many more numerous examples of such things going around in our day to day life. If you come upon some things, share it with me and i will do an analysis and post it on my blog.


No comments:

Post a Comment