How to approach the performance problems in any software? I think the only effective way of attacking any performance problem is one - Measure, Measure, Measure, Measure . Unless the real nature of problem cannot be verified it is difficult to provide a solution. It's a common pitfall that quick assumptions are made about the reasons and after so much effort one realizes that they are working on wrong set of problems.
The software performance problems can be looked into two dimensions:
- Time related.
- Space related.
The two are also interrelated to each other. One may lead to another but broadly one has to understand the behavior of application with respect to these two dimensions. The time related problem relates to how much time certain piece of code is taking and space related problem focuses on the need of memory by the system.
Once there is a clear idea about the nature of problem than the system can be tuned for better performance. There is usually a 20-80 (or 10-90 if you insist) ratio in performance issues. 80% of the issues are becuase of 20% area of application. So identify the hot spots where any improvement brings dramatic improvement in performance.
Perfromance is usually considered a black art so be ready for things which are not conventional or which were introduced for maintainability or good application design. Again the solutions should not be compromising on the aspects of maintainability and design.
Over engineered system tends to be slow in performing so it makes a lot of sense to invest time in analyzing design decisions with respect to performance implications right at earlier stages of application development. Be careful about introducing extra tiers or interfaces because some book has recommended it. Build a realistic approach to application development. Do not invent the requirements on your own. For example do not try to build a system where you attempt to make the front end in spring MVC and can be replaced with JSF by the flip of a switch unless there is a strong monetizing aspect associated with it. Value for Money and Value for Effort, ingrain this. Again be realistic about real world. Good software design practices are good but understand where those boundary lines are with respect to your system. (Please never quote this line, it is easily stretched on the other direction).
A basic code to take timings in Java
long startTime = System.currentTimeMillis();
//Your code here
long elapsedTime = System.currentTimeMillis() - startTime;
log.debug("Elapsed Time:" + elapsedTime);
No comments:
Post a Comment