LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-06-2019, 10:27 AM   #1
hokie1999
Member
 
Registered: Feb 2011
Posts: 52

Rep: Reputation: 0
cpu process utilization and top question


If I have a process that is running 100 percent (cpu) on a server that has 24 processors, is my cpu utilization 100 percent or is it 100 percent / 24 ?


$ cat /proc/cpuinfo | grep processor | wc -l
24

AND

$ top -bn 1
top - 15:21:46 up 768 days, 18:54, 2 users, load average: 1.18, 1.05, 1.04
Tasks: 336 total, 2 running, 334 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3.2 us, 4.9 sy, 0.0 ni, 91.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 65761736 total, 21233600 free, 22230472 used, 22297664 buff/cache
KiB Swap: 4194300 total, 4180908 free, 13392 used. 39833456 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3069 root 20 0 9.857g 9.598g 8440 R 100.0 15.3 2:07.00 mongod


Thanks!

Last edited by hokie1999; 08-06-2019 at 10:29 AM.
 
Old 08-06-2019, 10:50 AM   #2
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by hokie1999 View Post
If I have a process that is running 100 percent (cpu) on a server that has 24 processors, is my cpu utilization 100 percent or is it 100 percent / 24 ?
"Traditionally", it would not be considered running at 100% because you still have 23 more processors that could be doing work. (A nice sitation to be in, IMHO.) You just have a process that wasn't written to be aware of other CPUs and take advantage of them and it's monopolizing one of your processors.

You should be able to comfortably sustain a load of "N" where N=#cpus. Anything above that means there are processes waiting for a CPU. (In the olden days, we'd say there were hamsters waiting for their turn on the wheel.)

HTH...
 
1 members found this post helpful.
Old 08-06-2019, 11:00 AM   #3
hokie1999
Member
 
Registered: Feb 2011
Posts: 52

Original Poster
Rep: Reputation: 0
Thanks for answer. Let's say this mongod exceeds the single cpu's limit, let's say it's twice what cpu could handle. Would I likely see something like this:

$ top -bn 1
.
.
.

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3069 root 20 0 9.857g 9.598g 8440 R 100.0 15.3 2:07.00 mongod
3069 root 20 0 9.857g 9.598g 8440 R 100.0 15.3 2:07.00 mongod

Maybe the PID is an indicator of one process spread out over multiple cpus
 
Old 08-06-2019, 02:16 PM   #4
Rich Strebendt
LQ Newbie
 
Registered: Dec 2009
Location: Wheaton, IL
Distribution: CentOS 5.10
Posts: 22

Rep: Reputation: 7
I would not expect to see something like that unless the process is doing a heck of a lot of forking, but then I would expect to see the load spread out over most of the processors. The most processor a single thread program can use is 100% of one processor. The situation suggested in your last posting could arise if the same program was fired up as several processes each running a copy of the CPU hog.

Last edited by Rich Strebendt; 08-06-2019 at 02:17 PM. Reason: spelling error
 
1 members found this post helpful.
Old 08-06-2019, 02:31 PM   #5
tdsan
LQ Newbie
 
Registered: Aug 2011
Posts: 26

Rep: Reputation: Disabled
CPU Info

dmidecode --type processor

# dmidecode 2.12
SMBIOS 2.7 present.

Handle 0x0401, DMI type 4, 26 bytes
Processor Information
Socket Designation: CPU 1
Type: Central Processor
Family: Other
Manufacturer: Intel
ID: F2 06 03 00 FF FB 89 17
Version: Not Specified
Voltage: Unknown
External Clock: Unknown
Max Speed: 2400 MHz
Current Speed: 2400 MHz
Status: Populated, Enabled
Upgrade: Other

Great write-up on a number of ways to extract data from Linux - https://www.tecmint.com/check-linux-cpu-information/

Also, install Monitorix on the system and view processing every few minutes on a webpage.

top -n 1 | grep -i ^cpu (by changing top -d 3 | grep -i ^cpu is another)

T

Last edited by tdsan; 08-06-2019 at 02:34 PM. Reason: Added a top statement
 
1 members found this post helpful.
Old 08-06-2019, 02:48 PM   #6
hokie1999
Member
 
Registered: Feb 2011
Posts: 52

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Rich Strebendt View Post
I would not expect to see something like that unless the process is doing a heck of a lot of forking, but then I would expect to see the load spread out over most of the processors. The most processor a single thread program can use is 100% of one processor. The situation suggested in your last posting could arise if the same program was fired up as several processes each running a copy of the CPU hog.
No, only one process, no forks.

Or, if a process is running really busy, it grabs the one cpu and simply slows down, in other words, it wants 101 percent, but it only gets 100 percent. If that is the case, may explain why some of our processes seem slow, slow as in sluggish to reload configs and rules (this is IDS).

Interesting, and thank you.
 
Old 08-06-2019, 03:03 PM   #7
hokie1999
Member
 
Registered: Feb 2011
Posts: 52

Original Poster
Rep: Reputation: 0
Here is example of IDS (Intrustion Detection) app called Suricata, top shows this:

31736 root 20 0 7421732 6.768g 445700 S 124.4 5.4 10956:30 Suricata-Main

Looks like after it hits 100 it must load balance to another cpu, doesn't say which. By that logic, at 24 cpus on this server, utilization could go to 2400 percent.
 
Old 08-06-2019, 06:16 PM   #8
tdsan
LQ Newbie
 
Registered: Aug 2011
Posts: 26

Rep: Reputation: Disabled
CPU Resource Utilization

I have included an image for your review.

Monitorix gives the user the ability to view the history of the processor(s) among other things, I have Cloud and external sites presenting this information.

It is pretty nice and can be installed in almost any Linux/Unix System.

T
Attached Thumbnails
Click image for larger version

Name:	Monitorix_Network_CPU_Monitoring.jpg
Views:	30
Size:	100.4 KB
ID:	31046   Click image for larger version

Name:	cpu_image_capture.png
Views:	29
Size:	206.2 KB
ID:	31047  

Last edited by tdsan; 08-06-2019 at 06:58 PM.
 
Old 08-06-2019, 06:16 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,133

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
This is a large part of the reason we now have large numbers of "CPUs" in our systems - it all got too hard to keep up with Moore's Law and grow the CPU. Easier to go sideways than up. But that meant code had to become multi-processor aware and multi-threaded to use it all efficiently.

As you've found "top" shows non-normalised numbers - but you'll never get near 2400% as the overheads to manage that multi-threading grow exponentially, for both the application and the operating system.
 
  


Reply

Tags
cpu, processor, top, utilization



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: CPU utilization, top Blender video tutorials, Python, Linux, Stratis, Pidgin, and more LXer Syndicated Linux News 0 05-01-2018 10:24 AM
High Run queue utilization although CPU utilization is low.. rajeprag Linux - Server 0 08-18-2013 09:44 AM
ps and top Commands are giving Different %CPU Utilization for the Same Job devUnix Linux - Server 8 05-16-2012 09:44 AM
Linux desktop GUI tool for CPU utilization and bandwidth utilization karimasif Linux - Software 4 03-03-2008 01:09 PM
Alert used "cpu load" and "cpu utilization" viky General 0 07-23-2007 03:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration