Tuesday, January 12, 2016

Application performance tuning

Several Application have stabilization & performance issue. Here are following suggestions that will help them to stabilize the software & improve the performance of .Net or Java application:
RAM & CPU usage: On task Manager of windows operating system. Please keep on looking the performance tab now & then. Note down the CPU & RAM usage now & then. Suppose your RAM goes up at the pick business hour. But it should come down at off business hour. If it is not coming down then you have potential memory leaks in the application. You need to scan the code & close the different type of input streams, database or socket connections and any data structure that needs closing. Please remember any healthy RAM should be always 50% free. If your RAM usage is above 75%, you must be worried.

JMeter: It is also a good tool for stress testing which helps in Application longevity & memory leak identification. Put the URLs which are giving the errors in the production log files in the JMeter. Run it for some time, it will give you the exceptions & one need to fix them. Once you start fixing them, your application will get more stable.

CPU usage: The CPU usage must show up & down on task Manager. The down should be below 5% usage & it must touch zero also. If your CPU is not coming down very frequently then there are some costly functions & database queries are getting executed. You need to tune them.

Code tuning: Any code which is using 4 level of if conditions or loops is bad code. It logic needs to be changed. Any method going beyond 100 lines should be broken into other methods.
If your code is waiting for any connection such as blog, network connection, URL opening. They need to be loaded in the pool on-init method call in separate thread or connection pool or object pool.
Static: Avoid this static key word as much as possible particularly for methods. It leads the data corruption & may also lead to bloating of data structures in the RAM.

Asynchronous servlet: If you can use this one also to avoid ontime loading of the data. Java has introduced callable & future interfaces for asynchronous call for heavy queries & functions.

Query tuning & DB indexing: One can use the TOAD tool for oracle for query cost. Using toad, you can do the required changes in the query & see if your query cost goes down. Additionally, if you are not in the condition to change the query then query cost will help you to which column to index. Look for the difference in the normal index, function based index, clustered index etc. Such as for following query, one need the function based index. Normal index won’t work.
SELECT UPPER(column_name) FROM table_name;

Caching: It is a powerful mechanism. You can even cache dynamic data. Please have a look at Memcached etc,

YSlow: This is the browser plugin. Once your page are loaded, you can run this plugin. It will rate your page & will give you multiple suggestions to improve your page.
Infra changes: Also look if you have got the proper infrastructure in place.
There are few other ways to do performance tuning:   HTTP Compression, Limiting Connections etc.
Use angularjs for request handling from the form.



No comments:

Post a Comment