Friday 12 December 2014

Longevity

If you check a dictionary for the meaning of the word "longevity" you will see:

longevity:  noun  \län-ˈje-və-tē, lȯn-\ 
the fact of living for many years, the length of life, the length of time that something or someone lasts or continues

Ripped 60-Year-Old Bodybuilder
A familiar story 
After completing the software, doing many tests and giving a final demo to the user, fixing and testing again and again. It comes the time to give the software to the user and have it work in real world. Three important things may makes user unhappy:

  • Finding some bugs
  • Wishing to have some new features or changes
  • Crashing at the first days of working

These things happens and none of them is our concern, you usually fix them in a short period of time. The problem is when software works for long period of time, say months, years without restarting usually some other strange things happens, like:



  • It gradually gets slower and slower
  • It starts to respond abnormal (not like it used to respond) 
  • It crashes without no special reason
You wake up every day in the morning and go for a run. How long can you run? Ho many days you think you can continue this? A week, month, year, years ... If you don't prepare yourself you may run for half an hour a day, not more. If you prepare yourself you may run an hour or two. But can you do it all days? No, it needs some other things, more than practicing, it needs a good diet and enough of rest too and wisdom of course.

A software is the same, you may write a program which only works for a few days and if you don't restart it, it crashes or gets slow, or may build the same software somehow it works many years without any problem. (By the way, why Windows operation system gets more slow over time than Linux!!!)

Longevity test
All is about testing the software at the real environment for long period of time to see if it fails to work or not. The more it works without any change on its performance and behavior the better longevity it has. 

What causes short longevity?
Software longevity highly depends on its stability. And by stability, I mean having the same situation or feel of work all the time as it has just a second after restarting. What does it mean? Let me talk about most common problems which usually are the main reasons of software failure in long period of time:
  • Memory leak: If your software eats 1KB of memory per user per hour which is nothing, after a day you will lose 24KB/User, after a month 720KB/User, after a year 8.6M/User. Now if you have an average of 500 connected users, then your software will eat 360MB/month or 4.32GB/year! This problem will never show itself in a short period of time or when you don't have many connected users. 
  • Disk space: There are limited number of programmers who cares about the disk space, most of them always think they have enough amount of available disk space. We can do same calculation as above for disk space. Some software easily wastes disk space, and if they don't consider it they will crash soon. In fact, the thing is programmers usually don't catch the file operation exceptions ... carefully.
  • Integration: Working with other software and systems in a software ecosystem is another important thing which leads software to fail after a long period of time. Programmers usually think the other integrated systems work at their best conditions as their system likes, but they won't and don't. During the time, these aliens will show strange reactions and if your software doesn't be ready for these situations it will crash. 
  • Infinite loops or deadlocks: Yes, these two also happens when you don't consider boundary conditions, or thread safe regulations and ... but this time, the application eats CPU or stuck and does nothing.
There are many other issues we have to consider in our software development to have better longevity. Note that if you don't consider these things in your, when facing them, the debugging will be a total disaster. I'll try to talk about all in a detail pretty soon.

No comments:

Post a Comment