Knowledgebase

Portal Home > Knowledgebase > Articles Database > *nix CPU usage explnation


*nix CPU usage explnation




Posted by BookMarc, 06-11-2008, 03:33 PM
Hi Guys, I ran a TOP command on my two servers but i really dont understand the output ... could someone please explain... i specially and really really need to under the memory and cpu usage of the servers. please could someone explain what cpu and mem values really are ... example what is 98.0% us, 0.0% ni, 0.0% wa, 0.2% si etc... as shown besides Cpu(s) and what is 183100k buffers in the Mem how are the server loads calculated? Please help. Thanks in advance. +++++++++ Server 1 +++++++++ top - 00:54:09 up 12 days, 1:10, 1 user, load average: 20.64, 15.69, 10.83 Tasks: 138 total, 21 running, 117 sleeping, 0 stopped, 0 zombie Cpu(s): 98.0% us, 1.7% sy, 0.0% ni, 0.0% id, 0.0% wa, 0.2% hi, 0.2% si Mem: 2005856k total, 1767704k used, 238152k free, 183100k buffers Swap: 2040244k total, 128k used, 2040116k free, 810588k cached +++++++++ Server 2 +++++++++ top - 00:54:59 up 67 days, 23:03, 1 user, load average: 0.10, 0.07, 0.02 Tasks: 122 total, 1 running, 121 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0% us, 0.2% sy, 0.0% ni, 99.8% id, 0.0% wa, 0.0% hi, 0.0% si Mem: 2005396k total, 1948624k used, 56772k free, 53848k buffers Swap: 2040244k total, 144k used, 2040100k free, 1499772k cached

Posted by The Universes, 06-11-2008, 03:45 PM
CPU Usage is split into percentage consumed by: Users System Nice Idle IO Wait Total Memory Memory Used/Allocated Memory Thats Free Buffers (disk buffers + cache) Load Average on Wikipedia: http://en.wikipedia.org/wiki/Load_(c...ad_calculation Last edited by The Universes; 06-11-2008 at 03:48 PM.

Posted by BookMarc, 06-11-2008, 04:25 PM
Firstly thanks for the reply. Users are using cpu= 98.0% us System is using cpu= 1.7% sy Nice = 0.0% ni Idle = 0.0% id IO Wait = 0.0% wa is the above right? what exactly does IO Wait mean? having 0.0% wa good or bad? what is 0.2% hi, 0.2% si? Thanks again in advance.

Posted by The Universes, 06-11-2008, 04:41 PM
No problem. That right. iowait is the CPU waiting for the disk to read and 0 is good. anyone know what hi and si are?

Posted by insanelymacintosh, 06-12-2008, 02:03 AM
I usually always go by the "load average: 20.64" area to see how the server is doing... 20.64 is really really bad! 1.00 is... about average I guess. Anything below 1.00 is really good. Anything at like say.... 4 or 5 then the server is really starting to get bogged down to the point where webpages load time is noticeable slower, and receiving email is noticeably slower. Sorry, not too sure about hi or si

Posted by luki, 06-12-2008, 02:46 AM
The load average is essentially the number of processes in the run queue, or in other words the number of processes wanting to run. Ideally you don't want to have more processes in the run queue than you have CPUs, so this isn't a hard number. With 4 CPUs (not uncommon) a load averages of 4 is perfectly fine; with a modern CPU and a task scheduler even a load of 8 is very responsive. FYI: si: The amount of time the CPU has been servicing software interrupts. hi: The amount of time the CPU has been servicing hardware interrupts. The man page for top is very informative. Read it.

Posted by BookMarc, 06-12-2008, 04:08 PM
Now this is what i was really looking at you the man let me ask you this... my server constantly has high loads 10 - 15 and even as high as 20 as you can see... now my question is 1) i am getting a new server with Single Processor Quad Core Xeon 3220 - 2.40GHz (Kentsfield) and 4 GB RAM so essentially this is as good as having 4 CPUs right? and the extra RAM (server 2gb in the old server - 4 gb in the new one) also helps right? 2) How do i kind out what processors are running and like you said "processes in the run queue, or in other words the number of processes wanting to run" Read the man page did not find much info there ... http://www.linuxmanpages.com/man1/top.1.php is having 0.2% hi and 0.2% si good or bad? Thanks a ton.

Posted by BookMarc, 06-12-2008, 04:49 PM
OK got another question which i was just looking at TOP... even thou the server is hardly beinbg used and load is 0 why is the RAM usage so high and how can i find out which process is using so much RAM? Thanks

Posted by BookMarc, 06-14-2008, 11:19 AM
anyone wants to help me with the above two posts? Thanks again

Posted by The Universes, 06-14-2008, 01:25 PM
Free RAM is "bad", because that RAM can be used as disk cache and buffer instead of sitting idle. Type free -m and see. Most of it is probably not used by applications. You can do a ps aux and look at the %MEM column to see which applications are using the greatest percentage of RAM.

Posted by RBBOT, 06-14-2008, 03:50 PM
You don't need to run "free -m" - the information is already in the output of top. The "cached" reading is the disk cache memory usage. This really belongs on the line above - it is related to the memory, not the swap but is moved down to fit in 80 characters. In your examples you have 1946936k used, but of that 1523096k is disk cache, which is good. 52808k is "buffers" which essentially means memory allocated by the kernel for things such as sending packets over the network. That means you only have 371032k in use by applications. You can see which application is using what ram from the RSS column in the process list in top, but bear in mind if a process forks multiple copies of itself (e.g. httpd), they may be sharing some, but not all, of the memory in the RSS column. Also the distinction between user and system in the CPU line isn't between "user processes" and "system processes". All processes spend some of their time running user application code, and some of their time running system code (e.g. when reading a file from disk).

Posted by BookMarc, 06-15-2008, 01:14 PM
What about the below??? top - 00:54:09 up 12 days, 1:10, 1 user, load average: 20.64, 15.69, 10.83 Tasks: 138 total, 21 running, 117 sleeping, 0 stopped, 0 zombie Cpu(s): 98.0% us, 1.7% sy, 0.0% ni, 0.0% id, 0.0% wa, 0.2% hi, 0.2% si Mem: 2005856k total, 1767704k used, 238152k free, 183100k buffers Swap: 2040244k total, 128k used, 2040116k free, 810588k cached

Posted by BookMarc, 06-15-2008, 01:17 PM
let me ask you this... my server constantly has high loads 10 - 15 and even as high as 20 as you can see... now my question is 1) i am getting a new server with Single Processor Quad Core Xeon 3220 - 2.40GHz (Kentsfield) and 4 GB RAM so essentially this is as good as having 4 CPUs right? and the extra RAM (server 2gb in the old server - 4 gb in the new one) also helps right? 2) How do i find out what processors are running and like you said "processes in the run queue, or in other words the number of processes wanting to run" is having 0.2% hi and 0.2% si good or bad? Thanks a ton.

Posted by Website themes, 06-15-2008, 01:36 PM
The new CPU will only help if its got more power than your current dedi. Since you haven't told us what CPU your current server has we can't tell you. However I can tell you that quad core is not the same as 4 independent CPUs. Its close, but independent CPUs have unshared cache memory and full front side bus so they are faster. However Linux will treat the 4 cores as 4 cpus so a top load average of 4-10 is fine. The increase in memory may or may not help depending on your current usage. IF the figures you quoted here are of peak traffic periods then it seems you already have some ram free (200MB +) so you don't absolutely need more. You can sort the Top command output: shift+p to find out which processes are using up the most CPU shift+m to find out which process are using up the most RAM. I doubt the hi and si figures are anything to worry about.

Posted by BookMarc, 06-15-2008, 02:08 PM
My current CPU Processor #1 Vendor: AuthenticAMD Processor #1 Name: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ Processor #1 speed: 1994.467 MHz Processor #1 cache size: 512 KB with 2 GB RAM. the os it runs on is - CentOS 64 bit ================ current TOP stats ================== top - 23:31:04 up 15 days, 23:47, 1 user, load average: 9.57, 10.95, 14.50 Tasks: 120 total, 6 running, 114 sleeping, 0 stopped, 0 zombie Cpu(s): 98.8% us, 1.2% sy, 0.0% ni, 0.0% id, 0.0% wa, 0.0% hi, 0.0% si Mem: 2005856k total, 1592128k used, 413728k free, 137864k buffers Swap: 2040244k total, 128k used, 2040116k free, 861508k cached ======================================================= the server i am going for is of the below config: Processors: Xeon x3220 2.4 Ghz 4GB DDR2 533 / 667 ECC RAM 2x250GB SATA II RAID 1 I run a phpBB forum which has approx 100 - 125 users online at all times however the forum has a lots of mods installed so it requires more processing power. or atleast thats what i have been told. Is phpBB made to handle threads / available parallelism of multi core processors In the above given circumstance will the quad core cpu and extra ram help? Thanks ps: just incase someone misses this questions Is phpBB made to handle threads / available parallelism of multi core processors Last edited by BookMarc; 06-15-2008 at 02:17 PM.

Posted by The Universes, 06-15-2008, 02:19 PM
That new server will definitely help a lot. I would recommend optimizing your phpBB installation though, as much can be done. I tend to lean towards optimizing an application to better scale since you will hit that wall again when the site hits a particular concurrent users. Its not phpBB that needs to thread for quad core, its the Apache web server and it does. I'm assuming your using apache, since its the most common, correct me if I'm wrong. The extra RAM should help too: disk cache, use the extra memory for php opcode caching and mysql qcache and buffers.

Posted by BookMarc, 06-15-2008, 02:36 PM
Yes, web server is Apache. How do i multi-thread Apache? could you please explain a little bit more. What do i need to tell my server guys? whats is php opcode & mysql qcache and buffers? php info is here >> http://72.232.211.66/info.php max_execution_time = 60 ; Maximum execution time of each script, in seconds max_input_time = 60 ; Maximum amount of time each script may spend parsing $ memory_limit = 128M ; Maximum amount of memory a script may consume (32MB) Please could you explain mysql on my server has been optimized and then optimized some more... here are few of the current setting... key_buffer_size = 400M query_cache_limit=1M query_cache_size=128M query_cache_type=1 thread_cache_size=256 join_buffer=8M table_cache=2048 record_buffer=8M read_buffer_size=4M read_rnd_buffer_size=300K *on my knee* i really need these answers. Thanks in advance.

Posted by The Universes, 06-15-2008, 05:24 PM
Take a look at this article: http://2bits.com/articles/php-op-cod...arge-site.html A few examples of opcode cachers are xcache, eAccelerator, APC, and so on. I can't look at your my.cnf and tell you if its "optimized", it has to be based on usage statistics so it is different for each situation.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read


Language:

Contact us