Friday, 16 January 2015

Memory Bottleneck Insights - How to find/Tips to resolve



As we know that memory is a holding place for instructions and data that the microprocessor can reach quickly. So while processing, the memory contains the main parts of the operating system and some or all of the application programs and related data that are currently being used.
Below diagram can give you some inference on where the data can be stored and which storage areas can render faster response.


Threads & Process
So while seeing about memory, there are two elements that comes into picture.
  • Process
  • Threads
Process is one instance of a running application and all the memory and other resources associated with it. Threads on the other side, is one path of execution through application’s code. A process can consist of one or many threads of execution.

So what is a bottleneck?
A component is said to be bottleneck whose performance limits the optimum performance of other components. It can because of the any of the following reasons:
  • Insufficient resources
  • Resource malfunctioning
  • Uneven workload sharing
  • Incorrect configuration of resources
  • Monopolization of a particular resource

Paging/Swapping
Paging is a movement of pages of data between disk and main merry. when there are too many pages in memory, the RAM shortens in capacity to have all the pages in it, so it uses 'virtual memory'. When each page in execution demands that page that is not currently in real memory (RAM), it places some pages on virtual memory and adjusts the required page on RAM. The state of excessive paging is called Thrashing. It is a state in which the CPU performs 'productive' work less and 'swapping' more. This could lead to a major memory bottleneck.

Performance Counters
Let’s see some of the memory counters now and how these counters can be added in a Windows OS.
Memory Object
The memory object describes the behaviors of physical and virtual memory on the computer
Physical memory is the amount of RAM on the computer. Virtual memory consists of space in physical memory and on disk.



How to add memory counters:
  • Go to perfmon utility.
  • click on Add counters
  • Choose Memory as performance object
  • Sekect the counters that you want tomonitor.



 Memory Cache

This is a place where the processor stores the data or instructions that is currently working at the time or is predicted to work shortly. It allows the processor to get the information quickly from the faster cache memory. The net result is a more efficient and faster running system.

 Memory Leak
It occurs when applications allocate memory for use but don not free allocated memory when finished.. It causes temporary memory shortages in application programs that run for a short time. It causes system to allocate all available memory to one process. Eventually, the system hangs till the memory is released.




 Tuning Tips for memory resources:
  • Increase physical memory about above the minimum required.
  • Create multiple paging files while using multiple disks.
  • Determine the correct size for the paging files
  • The initial size fi the paging file is between 1 and 1.5 times the amount of RAM available
  • Check the available space on your disks. Do not use large paging files.
  • Ensure effective usage of Cache memory.
  • Monitor the applications and replace those that leak memory or use it inefficiently
  • Shut down the services that are not required by the application
  • Replace 16-bit system with 32-bit or 64-bit systems
  • Run memory-intensive programs on the high end computers or when the system workload is light.

 Reasons for memory bottlenecks
  • Too many page faults - Having too many page faults leads to excessive program execution delays. Ensure that your application doesn’t experience too many hard faults
  • Disk contention
  • Competition for memory - When memory is scarce, the memory access pattern of one program can unduly influence other running programs. 

No comments:

Post a Comment