LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-11-2008, 07:38 AM   #1
baddah
Member
 
Registered: Feb 2006
Location: Cape Town,South Africa
Distribution: Fedora Core 8
Posts: 188

Rep: Reputation: 30
Better CPU Utilization on FC8


Hi,

I have a Intel Xeon 2.66GHz Dual Core CPU. On this server i have a script that will run at specified intervals. In Most cases the script is the only real process running on the server,so i want to maximise the CPU utilaztion as much as i can.

The problems is that currently is only using about 30% on average of the CPU.

Code:
Extract from vmstat 1

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  0     60  57360 150372 1736152    0    0     0  3552 1675 13538 29  7 48 16  0
 1  0     60  57324 150372 1736152    0    0     0  3552 1671 13482 30  7 46 17  0
 1  1     60  57324 150372 1736152    0    0     0  3572 1683 13607 29  7 47 17  0
 1  0     60  57324 150372 1736152    0    0     0  3556 1677 13531 31  7 44 17  0
 0  1     60  57324 150376 1736152    0    0     0  3560 1673 13557 30  7 46 17  0
 0  1     60  57324 150376 1736152    0    0     0  3552 1671 13510 28  6 50 15  0
 2  0     60  57200 150376 1736152    0    0     0  3548 1672 13521 27  7 50 16  0
 1  0     60  57200 150376 1736152    0    0     0  3812 1652 13082 29  6 48 17  0
 2  0     60  57200 150380 1736152    0    0     0  3556 1671 13528 28  6 50 15  0
 1  0     60  57200 150384 1736152    0    0     0  3560 1675 13549 29  5 50 16  0
 1  0     60  57200 150388 1736152    0    0     0  3552 1670 13524 31  7 45 17  0
 1  0     60  57200 150388 1736152    0    0     0  3556 1675 13514 30  7 46 18  0
 1  0     60  57200 150388 1736152    0    0     0  3560 1675 13551 28  8 48 16  0
 1  1     60  57116 150388 1736152    0    0     0  3544 1666 13476 30  7 44 18  0
 1  0     60  57076 150392 1736152    0    0     0  3560 1674 13555 30  7 46 17  0
 1  0     60  57076 150392 1736152    0    0     0  3540 1671 13481 29  7 48 17  0
 1  0     60  56404 150392 1736152    0    0     0  7160 1489 11663 25  6 45 24  0
 1  0     60  56456 150392 1736152    0    0     0  4096 1669 13313 30  7 46 17  0
 1  0     60  56456 150396 1736152    0    0     0  3544 1672 13386 29  6 48 17  0
 2  0     60  56456 150400 1736148    0    0     0  3540 1666 13432 28  6 50 16  0
 1  0     60  56456 150400 1736152    0    0     0  3552 1678 13512 28  6 50 15  0
 1  0     60  56456 150400 1736156    0    0     0  3564 1682 13576 31  6 45 17  0
 0  1     60  56456 150400 1736156    0    0     0  3584 1678 13539 30  6 48 16  0
 1  0     60  56456 150400 1736156    0    0     0  3532 1674 13442 29  7 48 17  0
 2  0     60  56456 150400 1736156    0    0     0  3568 1680 13587 29  7 47 17  0
 1  0     60  56456 150404 1736156    0    0     0  3564 1680 13542 29  6 50 16  0
The scrip runs for quite a while, and i'd like to let ir run at between 70 and 80% to shorten the time it takes to execute.

I have tried running it with nice -n -20 , but this had no effect at all. How can i optimize the CPU utilization for this script so that it'll use between 70 and 80% of the CPU when it executes.
 
Old 07-11-2008, 07:54 AM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

The script is probably waiting for I/O if it's not maxing out the processor. What does 'top' look like when the script is running?

Dave
 
Old 07-11-2008, 08:09 AM   #3
baddah
Member
 
Registered: Feb 2006
Location: Cape Town,South Africa
Distribution: Fedora Core 8
Posts: 188

Original Poster
Rep: Reputation: 30
Hi,

Here's the output from top

Code:
Tasks: 104 total,   2 running, 101 sleeping,   0 stopped,   1 zombie
Cpu(s): 29.8%us,  6.6%sy,  0.0%ni, 45.8%id, 17.3%wa,  0.3%hi,  0.2%si,  0.0%st
Mem:   2072676k total,  2016584k used,    56092k free,   150636k buffers
Swap:  2096376k total,       60k used,  2096316k free,  1736244k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 6829 root      20   0 14180 7052 2796 R   43  0.3   0:43.35 NewFetchAccount
 4354 mysql     20   0  136m  27m 4824 S   24  1.4 278:14.44 mysqld
  522 root      15  -5     0    0    0 S    8  0.0  17:12.22 md2_raid1
    1 root      20   0  2112  660  572 S    0  0.0   0:22.53 init
    2 root      15  -5     0    0    0 S    0  0.0   0:00.00 kthreadd
    3 root      RT  -5     0    0    0 S    0  0.0   0:00.06 migration/0
    4 root      15  -5     0    0    0 S    0  0.0   0:00.03 ksoftirqd/0
    5 root      RT  -5     0    0    0 S    0  0.0   0:00.00 watchdog/0
    6 root      RT  -5     0    0    0 S    0  0.0   0:00.09 migration/1
    7 root      15  -5     0    0    0 S    0  0.0   0:02.63 ksoftirqd/1
    8 root      RT  -5     0    0    0 S    0  0.0   0:00.00 watchdog/1
    9 root      15  -5     0    0    0 S    0  0.0   0:00.02 events/0
   10 root      15  -5     0    0    0 S    0  0.0   0:11.20 events/1
   11 root      15  -5     0    0    0 S    0  0.0   0:00.00 khelper
   63 root      15  -5     0    0    0 S    0  0.0   0:00.05 kblockd/0
So the total CPU is 29% here, with the script taking most of it and mysql, which the script uses, the rest. I guess if its waiting for I/O i'll have to try and optimize it here. Just thought ,looking at the CPU utlization ,the script was not running to its full potential, but i guess it is.

Thanks
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux desktop GUI tool for CPU utilization and bandwidth utilization karimasif Linux - Software 4 03-03-2008 01:09 PM
per process Cpu utilization kunal_patel22 Linux - Software 4 12-04-2007 05:14 PM
CPU utilization ust Linux - Software 1 10-11-2007 06:05 AM
CPU 100 % Utilization rajaniyer123 Solaris / OpenSolaris 1 09-20-2007 11:31 AM
CPU utilization in 2.4 vs 2.6.. lynz Linux - Software 2 06-04-2007 01:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:35 PM.

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