Sunday, July 25, 2010

How to improve performance of an application when you know nothing about that?

An application is given to you and now the question is how to improve the performance of that application?

Initially you know nothing about that application. So how do you execute the above task? Its through LEARNING. Learning could come through books, colleagues, google ..... and finally it could come from your own experience too.

Before answering the above question let us define the term performance. Bad performance means the system/application is delivering the output with some glitches. Performance of an application is measured in terms of efficient usage of resources. In other words improving the performance means finding and rectifying the inappropriate usage of resources. At the bottom level, it could end up in identifying and rectifying defects in the application either it could be in the application code or database or any other middle level layers.

Time is an important factor as for as the performance engineering is concerned. Less the time taken for a given task, better the usage of resources. Some times it could end up with using excessive usage of resources too. There should be a well balance between the usage of resources and the performance of the system.

Now what are all the resources used by that application?

1. I/0

File Access, database file access, other storage access, socket read/write and inter process communication etc.

2. CPU

CPU is used heavily for all computational intensive operations.

3. Memory

Memory helps you to reduce I/0 and hence you will get better performance by making
full use of memory.

1. Now identify the set of operations for which the performance is not upto the mark.
2. Prepare right tools to monitor the above resources while performing those operations. For example CPU, memory, IO can be monitored through commands like top in linux. Task Manager in Windows could give us wonderful inputs. Memory Analyzers like OptimizeIt, JProbe could give us wealth of input. Custom tools like sql query analyzer to find repetitive queries and queries that taking longer time will be very handy. In the case of web servers/application servers, tools that are analyzing http headers could help us to identify unncessary requests or repetetive requests.
3. Execute above operations and see the usage of resouces while doing the same.
4. Identify abnormal usages and try to rectify them. For example excessive IO could be rectified by proper caching, efficient usage of algorithms, indexing or even some times replacing default discs with high speed discs like RAID could do.
5. Excessive memory usage could be identified through OptimizeIt or JProbe. They have the capacity of identifying root cause of the excessive object creation. It could be because of the bugs in the application or we can go for object pooling to minimize temporary objects creation.
6. Like wise excessive CPU usage could be avoided by using efficient algorithms or sometimes through parallel processing etc.

At the end, if you get success, you will be a WELLKNOWN from UNKNOWN as for as the application is concerned.

No comments:

Post a Comment