Showing posts with label Server Monitoring. Show all posts
Showing posts with label Server Monitoring. Show all posts

Wednesday, January 13, 2016

High VM Memory analysis and lessons learnt

This week I investigated a high VM memory utilization on a JBoss servers in production
Using the Linux top command found that the JBoss - Java process was hogging 6.8 GB (Resident Memory). We have set JVM to 6144MB JVM.
Lets look at the sizing formula - 

Max memory = [-Xmx] + [-XX:MaxPermSize] + number_of_threads * [-Xss]

6144 MB + 384 MB + 25 MB (Say 100 threads * 256 K = 25mb) = 6553 MB (Close to 6.8 GB) +
Read this article -

https://dzone.com/articles/why-does-my-java-process which says - But besides the memory consumed by your application, the JVM itself also needs some elbow room.


This means the actual memory the JBoss uses is not equal to the JVM set, but its more at least in case of JAVA 1.7.

One more thing I learnt in investigation. There were several other java processes related to machine agent. We use a APM tool and this tool has a  machine agent which is used to collect the VM resources for correlation Recently the script to restart the JBoss servers were changed from killall -9 java to kill -9 . Due to this for some reason the machine agent processes were left hanging for each day. Each process was hogging 50-60 MB which over days becomes significant given that OS also requires memory.I wonder what would come out as the root cause of the Application servers swapping. It would sound something like this - " The issue of slowness/servers crashing/swapping was due to a APM tool agent" :)

Sunday, January 3, 2016

What to ELK (work in progress)

User Activity Data
How many reports ?
How many Logins ?
How many transactions done?

Host Activity Data
What is the CPU utilization ?
What is the Memory utilization ?

Application Activity Data

Which reports are being accessed most ?


Server logs - Exceptions logging/Excessive logging

Top slow and high count URLs
Respond code wise name and count of URLs
Response time wise (bucket) name and count of URLs
IP wise count of URLs


Security Infrastructure Data-
How many failed logins ?
How many logins ?

Database-
Slow Query Logs

Real User Monitoring-
Page Render
Page Load
Page Weight
FTTB
Page requests
First Interactive Time
Speed Index.

Wednesday, December 10, 2014

What is the difference among VIRT, RES, and SHR in top output?

VIRT stands for the virtual size of a process, which is the sum of memory it is actually using, memory it has mapped into itself (for instance the video card's RAM for the X server), files on disk that have been mapped into it (most notably shared libraries), and memory shared with other processes. VIRT represents how much memory the program is able to access at the present moment.

RES stands for the resident size, which is an accurate representation of how much actual physical memory a process is consuming. (This also corresponds directly to the %MEM column) This will virtually always be less than the VIRT size, since most programs depend on the C or other library.

SHR indicates how much of the VIRT size is actually sharable memory or libraries. In the case of libraries, it does not necessarily mean that the entire library is resident. For example, if a program only uses a few functions in a library, the whole library is mapped and will be counted in VIRT and SHR, but only the parts of the library file containing the functions being used will actually be loaded in and be counted under RES.

Friday, November 28, 2014

Monitoring Load average


Load average represents the number of processes waiting in the OS scheduler queue. Unlike CPU, load average will increase when any resource is limited (e.g. CPU, network, disk, memory etc.). Please refer to the blog “Understanding Linux Load Average” for more details.
We can use the following load average values to decide whether a machine is loaded
  • If load average < number of cores, then the machine is not loaded
  • If load average == number of cores, then the machine is in full use
  • If load average >= 4X number of cores, then the machine is highly loaded
  • If load average >= around 40X number of cores, then the machine is unusable

One mistake often made is profiling the CPU without first determining whether it is truly a CPU bound use case. Although CPU utilization shown by top command is low, machine may be busy doing IO (e.g. reading disk, writing to network). Load average is a much better metric for determining whether the machine is loaded.

Generally three figures are seen in top or uptime command for load average, something like -
1.08, 0.8. 4.0. This means load average over 1,5 and 15 mins.

In top command, at the top-right hand corner you should see your load averages displayed as three numbers. These numbers are setup as follows:

Load Averages: 1.00 2.00 3.00
1.00 - 1 Minute average
2.00 - 5 Minute average
3.00 - 15 Minute average

In the example above, these load averages would indicate that 15 minutes ago the server was averaging a load of 3.00, while 5 minutes ago it was averaging a load of 2.00, and over the last minute it's been averaging a load of 1.00. This means that over the course of 15 minutes the server was doing a lot of work, 5 minutes ago it cut that workload in half, and then within the last minute it was cut in half again.

The Linux load average on a server is a rough estimate of the workload currently waiting to process.