{"id":2400,"date":"2022-08-30T15:24:33","date_gmt":"2022-08-30T15:24:33","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/05\/measuring-load-cpu-in-top-is-different-than-us-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:24:33","modified_gmt":"2022-08-30T15:24:33","slug":"measuring-load-cpu-in-top-is-different-than-us-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/measuring-load-cpu-in-top-is-different-than-us-collection-of-common-programming-errors\/","title":{"rendered":"Measuring load &#8211; %CPU in top is different than %us-Collection of common programming errors"},"content":{"rendered":"<p>When I run TOP on a remote server, I see a very small system utilization (3.8%us). However, for the actual process I am seeing 29.6% of the CPU.<\/p>\n<p>Since this server has 8 CPU cores, is the %CPU the utilization of only 1 CPU, while the <code>us<\/code> up top is over the 8 CPUs?<\/p>\n<p>When I divide 29.6 by 8, I get 3.7 which looks to validate my guess. So questions:<\/p>\n<ul>\n<li>The low utilization I am seeing is actually over 8 CPUs while the %CPU is for the CPU the process is using?<\/li>\n<li>What happens for processes that are utilizing more than one CPU?<\/li>\n<li>Does tomcat use more than one CPU if required? Or will tomcat crash if the load is increased but we will never be informed of high load<\/li>\n<\/ul>\n<p><strong>Top Output<\/strong><\/p>\n<pre><code>    top - 12:17:40 up 9 days, 21:51,  2 users,  load average: 0.32, 0.28, 0.27\n    Tasks: 201 total,   2 running, 199 sleeping,   0 stopped,   0 zombie\n    Cpu(s):  3.8%us,  0.1%sy,  0.0%ni, 96.1%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st\n    Mem:  16229072k total,  5617572k used, 10611500k free,   156480k buffers\n    Swap:  8388588k total,        0k used,  8388588k free,  2632452k cached\n\n      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND\n    32676 tomcat    20   0 12.4g 2.3g  10m S 29.6 14.6   2530:56 java\n<\/code><\/pre>\n<p>I have checked sources such as http:\/\/www.kernelhardware.org\/linux-top-command\/ , but not one of them makes the distinction between <code>%us<\/code> and <code>%CPU<\/code> .<\/p>\n<p>Only some ambiguous information such as: <code>%CPU - Percentage of CPU used<\/code><\/p>\n<ol>\n<li>\n<p>The CPU percentages shown in <code>top<\/code> are for all CPUs combined. To see per-CPU statistics, press 1 while <code>top<\/code> is running.<\/p>\n<p>The percentages in the process list, on the other hand, are a percentage of a single CPU core, and thus may exceed 100%.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2014-01-05 22:45:59. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>When I run TOP on a remote server, I see a very small system utilization (3.8%us). However, for the actual process I am seeing 29.6% of the CPU. Since this server has 8 CPU cores, is the %CPU the utilization of only 1 CPU, while the us up top is over the 8 CPUs? When [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2400","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2400","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2400"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2400\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}