1.CPU consumption Rate Analysis When CPU consumption is severe, mainly reflected in the US, sy, WA or Hi value is higher, WA is the value of IO wait caused by the high, hi to the main hardware disruption (such as network card data), for Java applications, CPU consumption is mainly reflected in us, sy two values.
When the US value is too high, it means that the running application consumes most of the CPU. Java applications cause US high because the threads are always in a Runnable state, usually caused by actions such as non-blocking, loop, regular, or pure computation, and another reason that can cause us high is the frequent GC.
When the SY value is high, it means that Linux spends more time on thread switching, and the main reason for Java applications is that there are a lot of startup threads, and most of these threads are in constant blocking (such as lock wait, io wait state) and execution state change process, This causes the operating system to continuously switch the executing thread, resulting in a large number of context switches.
Query basic steps:
+-top or Vmstat find the thread and its ID that consume CPU severity and convert this thread ID to a value of 16
+-kill-3 pid or Jstack [-l] PID | [grep ' nid=ox6849 '] to dump the application's Java thread information
2. File IO consumption analysis When using Iostat to view IO consumption, the first thing to focus on is the CPU iowait%, when iowait occupies the main percentage, it means to focus on IO consumption, then you can use the Iostat-x to detailed view of the specific situation.
Iostat-Install yum install Sysstat (CentOS) or aptitude install Sysstate (Ubuntu,debian)
IOSTAT-DX 1 Display IO information every second
Iostat-x SDA 3 Display SDA disk IO information every 3 seconds
Parameter resolution:
-R/S number of requests read per second
-W/S the number of requests written per second
-await average wait time per IO operation, in milliseconds
-avgqu-sz the average length of queues waiting for a request
-SVCTM average time to perform IO operations per Device
-util a few percent of a second for IO operations
3. Memory Consumption Analysis In the context of the environment, most Java applications will set-XMS and-xmx to the same value, avoiding the need to continuously request memory during the runtime.
For Java applications, memory consumption is mainly divided into JVM memory consumption and JVM heap memory consumption.
Excessive JVM memory consumption can result in frequent GC execution, increased CPU consumption, slow execution of application threads, and even outofmemoryerror, which eventually results in the Java process exiting.
JVM heap memory consumption, the most noteworthy is the consumption of swap and physical memory consumption.
Vmstat in which information and memory related to the main memory under the SWPD, free, buff, cache and swap Si and so
Parameter parsing
-SWPD virtual memory used, in kilobytes
-free Idle virtual memory
-buff Memory for Buffering
-cache user-Cached memory
-si The amount of data read from disk to memory per second
-so The amount of data written from memory to disk per second
Frequent swapio can cause SWPD to be too high
Because the Java application is a single process application, the JVM's memory settings will not operate to the swap area as long as it is not too large.
High physical memory consumption may be due to excessive JVM memory settings, excessive creation of Java threads, or the placement of excessive objects through direct bytebuffer into physical memory.
Sar-r 1 10 view memory consumption via SAR command (10 times per 1 seconds)
Top view the amount of memory consumed by the process where the Java process consumes memory = (jvm-xmx value) + Memory value outside the JVM
Pidstat-r-P [PID] [interval] [times] View the amount of virtual memory the process occupies
Parameter parsing
-MINFLT/S: The number of page faults per second (minor page faults), the number of times missing pages error means that virtual memory address is mapped to the number of page fault generated by physical memory address
-MAJFLT/S: Number of Main Page faults per second (major pages faults), when the virtual memory address is mapped to the physical memory address, the corresponding page is in swap,
Such page fault are major page fault, typically generated when memory usage is tense
-vsz: Virtual memory used by this process (in kilobytes)
-rss: The physical memory used by the process (in kilobytes)
-%mem: Percentage of memory used by this process
-command: Pull up the process corresponding command
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service