{"id":1641,"date":"2019-05-13T06:48:23","date_gmt":"2019-05-13T01:18:23","guid":{"rendered":"http:\/\/jaipurhosting.com\/blog\/?p=1641"},"modified":"2019-06-12T07:44:44","modified_gmt":"2019-06-12T02:14:44","slug":"understand-linux-load-averages-and-monitor-performance-of-linux","status":"publish","type":"post","link":"https:\/\/www.jaipurhosting.com\/blog\/understand-linux-load-averages-and-monitor-performance-of-linux\/","title":{"rendered":"Understand Linux Load Averages and Monitor Performance of Linux"},"content":{"rendered":"\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>Description<\/strong><\/p>\n\n\n\n<p>In this article, we will explain one of the critical Linux system administration tasks \u2013 performance monitoring in regards to system\/CPU load and load averages.<\/p>\n\n\n\n<p>Before we move any further, let\u2019s understand these two important phrases in all Unix-like systems:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>System load\/CPU Load<\/strong>&nbsp;\u2013 is a measurement of CPU over or under-utilization in a Linux system; the number of processes which are being executed by the CPU or in waiting state. <\/li><li><strong>Load average<\/strong>&nbsp;\u2013 is the average system load calculated over a given period of time of 1, 5 and 15 minutes. <\/li><\/ul>\n\n\n\n<p>In Linux, the load-average is technically believed to be a running average of processes in it\u2019s (kernel) execution queue tagged as running or uninterruptible. <\/p>\n\n\n\n<p><strong>Note that:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>All if not most systems powered by Linux or other Unix-like systems will possibly show the load average values somewhere for a user. <\/li><li>A downright idle Linux system may have a load average of zero, excluding the idle process. <\/li><li>Nearly all Unix-like systems count only processes in the running or waiting states. But this is not the case with Linux, it includes processes in uninterruptible sleep states; those waiting for other system resources like disk I\/O etc. <\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">How to Monitor Linux System Load Average<\/h3>\n\n\n\n<p>There are numerous ways of monitoring system load average including uptime which shows how long the system has been running, number of users together with load averages: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ uptime\n\n07:13:53 up 8 days, 19 min,  1 user,  load average: 1.98, 2.15, 2.21<\/code><\/pre>\n\n\n\n<p>The numbers are read from left to right, and the output above means that: <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>load average over the last&nbsp;<strong>1<\/strong>&nbsp;minute is&nbsp;<strong>1.98<\/strong> <\/li><li>load average over the last&nbsp;<strong>5<\/strong>&nbsp;minutes is&nbsp;<strong>2.15<\/strong><\/li><li>load average over the last&nbsp;<strong>15<\/strong>&nbsp;minutes is&nbsp;<strong>2.21<\/strong><\/li><\/ul>\n\n\n\n<p>High load averages imply that a system is overloaded; many processes are waiting for CPU time. <\/p>\n\n\n\n<p>We will uncover this in the next section in relation to number of CPU cores. <\/p>\n\n\n\n<p>Additionally, we can as well use other well known tools such as&nbsp;top&nbsp;and&nbsp;glances&nbsp;which display a real-time state of a running Linux system, plus many other tools: <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Top Command<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>$ top<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Glances Tool<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>$ glances<\/code><\/pre>\n\n\n\n<p>The load averages shown by these tools is read&nbsp;<strong>\/proc\/loadavg<\/strong>&nbsp;file, which you can view using the&nbsp;<a href=\"http:\/\/jaipurhosting.com\/blog\/basic-cat-commands-in-linux-with-examples\/\">cat command<\/a>&nbsp;as below: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ cat \/proc\/loadavg\n\n2.48 1.69 1.42 5\/889 10570<\/code><\/pre>\n\n\n\n<p>To monitor load averages in graph format, check out:\u00a0<a href=\"http:\/\/jaipurhosting.com\/blog\/ttyload-shows-a-color-coded-graph-of-linux-load-average-in-terminal\/\">ttyload \u2013 Shows a Color-coded Graph of Linux Load Average in Terminal<\/a><\/p>\n\n\n\n<p>On desktop machines, there are graphical user interface tools that we can use to view system load averages <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Understanding System Average Load in Relation Number of CPUs<\/h3>\n\n\n\n<p>We can\u2019t possibly explain system load or system performance without shedding light on the impact of the number of CPU cores on performance.<\/p>\n\n\n\n<p><strong> Multi-processor Vs Multi-core<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Multi-processor<\/strong>&nbsp;\u2013 is where two or more physical CPU\u2019s are integrated into a single computer system. <\/li><li><strong>Multi-core processor<\/strong>&nbsp;\u2013 is a single physical CPU which has at least two or more separate cores (or what we can also refer to as processing units) that work in parallel. Meaning a dual-core has 2 two processing units, a quad-core has 4 processing units and so on. <\/li><\/ul>\n\n\n\n<p>Furthermore, there is also a processor technology which was first introduced by Intel to improve parallel computing, referred to as hyper threading.<\/p>\n\n\n\n<p>Under hyper threading, a single physical CPU core appears as two logical CPUs core to an operating system (but in reality, there is one physical hardware component).<\/p>\n\n\n\n<p>Note that a single CPU core can only carry out one task at a time, thus technologies such as multiple CPUs\/processors, multi-core CPUs and hyper-threading were brought to life.<\/p>\n\n\n\n<p>With more than one CPU, several programs can be executed simultaneously. Present-day Intel CPUs use a combination of both multiple cores and hyper-threading technology.<\/p>\n\n\n\n<p>To find the number of processing units available on a system, we may use the&nbsp;nproc or lscpu commands&nbsp;as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ nproc\n4\n\nOR\nlscpu<\/code><\/pre>\n\n\n\n<p>Another way to find the number of processing units using&nbsp;<a href=\"http:\/\/jaipurhosting.com\/blog\/linux-grep-command-examples\/\">grep command<\/a>&nbsp;as shown. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ grep 'model name' \/proc\/cpuinfo | wc -l\n\n4<\/code><\/pre>\n\n\n\n<p>Now, to further understand system load, we will take a few assumptions. Let\u2019s say we have load averages below: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>23:16:49 up  10:49,  5 user,  load average: 1.00, 0.40, 3.35<\/code><\/pre>\n\n\n\n<p><strong>On a single core system this would mean: <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The CPU was fully (100%) utilized on average; 1 processes was running on the CPU (1.00) over the last 1 minute. <\/li><li> The CPU was idle by 60% on average; no processes were waiting for CPU time (0.40) over the last 5 minutes.<\/li><li>The CPU was overloaded by 235% on average; 2.35 processes were waiting for CPU time (3.35) over the last 15 minutes. <\/li><\/ul>\n\n\n\n<p><strong>On a dual-core system this would mean: <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The one CPU was 100% idle on average, one CPU was being used; no processes were waiting for CPU time(1.00) over the last 1 minute.<\/li><li>The CPUs were idle by 160% on average; no processes were waiting for CPU time. (0.40) over the last 5 minutes.<\/li><li>The CPUs were overloaded by 135% on average; 1.35 processes were waiting for CPU time. (3.35) over the last 15 minutes.<\/li><\/ul>\n\n\n\n<p><br> We hope you\u2019ve found this useful!&nbsp; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description In this article, we will explain one of the critical Linux system administration tasks \u2013 performance monitoring in regards to system\/CPU load and load averages. Before we move any further, let\u2019s understand these two important phrases in all Unix-like systems: System load\/CPU Load&nbsp;\u2013 is a measurement of CPU over or under-utilization in a Linux [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1642,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1641","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1641"}],"version-history":[{"count":2,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1641\/revisions"}],"predecessor-version":[{"id":1648,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1641\/revisions\/1648"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media\/1642"}],"wp:attachment":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}