Defining Performance and Performance Tuning

Why is My Application slow?

When we find that after an application is deployed, it is not performing as desired. In other words it’s not meeting non-functional requirements. This application now requires some fixes that may correct the problem. The process of refactoring an application to improve its performance is called tuning.

Before tuning we should also know, what is the user expectation (Non-functional requirement)?

  • How much user going to access the system as per NFR.
  • What is required throughput or response time user is expecting etc.
  • Dependency on third party application or software etc.

 

A definite improvement can be achieved if you do some tuning to your code. The Tuning Process may involve: Switching compilers, turning on optimizations using a different runtime VM, finding bottlenecks in the code or architecture that need some fixes.

There are always some limitations to our system i.e.

  • CPU speed and availability,
  • Memory availability
  • Disk and Network IO speed
  • Software limitation

 

Tuning can be performed at several layers.

  • At the hardware infrastructure level, we can improve the performance of our application by applying some hardware improvements like increasing our RAM, using a high performance CPU and other hardware up gradations.
  •  At the OS level there are several optimizations that can be done. Some of these include appropriate device driver settings, adjusting the swap space size and others.
  • Software infrastructure layer includes applications like the java virtual machine includes applications like the java virtual machine, database server, web server and the application server. These have vendor specific optimizations that can be applied on them.
  • At the application layer we can apply several code and design level optimizations.

 

Tuning Strategy

Once one problem is resolved another comes in hence follow the iterative process and tune unless until you get the required performance.

Tuning Steps – Find out the bottle necks, choose the quick fixes and repeat the process. Performance bottlenecks are identified during load testing and performance testing.

Below are some of the bottleneck areas and its reasons,

  • Extended response time of user
  • Extended response time of server
  • High CPU usage
  • Lots of open connections
  • Lengthy queues of requests
  • Memory leaks
  • Extensive table scans of database
  • Database deadlocks
  • Paging size and memory
  • Too much IO to Disk and Network
  • No multithreading support
  • Un-buffered streams
  • Caused by inefficient algorithm
  • To many objects and wrong allocation of these
  • Wrong coding practice etc

 

Some examples of performance problems and their solutions

1) If your application is hitting system memory limits, it may be paging sections in and out of main memory. In this case, the problem may be caused by too many objects, or even just a few large objects, being erroneously held in memory by too many large arrays being allocated (frequently used in buffered applications) or by the design of the application, which may need to be examined to reduce its running memory footprint.

2) If your application is CPU-bound, the code may need to be re-examined for bottlenecks, inefficient algorithms, too many short-lived objects (object creation and garbage collection are CPU-intensive operations) and other problems.

3) External data access or writing to the disk can be slowing your application. Hence first thing is to identify where the problem lies. Performance Tuning is an iterative process. Improving the CPU utilization may introduce a memory bottleneck. This tuning process continues till the desired performance is achieved.


Leave a Reply

Your email address will not be published. Required fields are marked *