Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running a rather intensive grep search, and even though the CPU is running around 95% and there are 7 others under 3%, the system threw it on there and its now competing for CPU (fast cgi which is also locked to that CPU is timing out frequently during the grep).

How would I go about finding where this is configured/setup.

share|improve this question

1 Answer 1

grep is single threaded.

You can try to split (man split) the file in to lots of smaller files to add parallelism.

If this is a linux host, you should look in to processor affinity settings. (man taskset)

Side note: Is this a true 8-core system? Or is it a 4-core with hyperthreading?

What do you mean when you say "The CPU is timing out". Do you mean fast-cgi responses time out?

share|improve this answer
It is linux. I mean grep is getting thrown on the already-full cpu. Is there a way to list all currently setup CPU affinities, or pinpoint where they are coming from (in the config files), –  user47133 Jun 30 '10 at 4:47
Its 2 quad cores. –  user47133 Jun 30 '10 at 4:52
generally the linux scheduler should auto balance these for you. But if you have a case where it isn't you can force the issue using taskset. (see man taskset) By default all processes generally are set with equal affinity for all processors. Did you give taskset a try? Also doing what I mentioned (splitting the big file up in to smaller pieces) may help you load balance more effectively. (lots of simplier small jobs are less likely to compete for resources than one big long running job) –  Joel K Jun 30 '10 at 4:57
I'm trying to push several fcgi child processes into their own cores, as they start with next to no RAM/CPU Usage, but expand as work is forked to them. I don't see a decent way to push all of them onto separate cores equally, is there? –  user47133 Jun 30 '10 at 5:00
You could also run concurrent fast_cgi so they load balance requests across multiple processes. The normal kernel scheduler should balance things fairly. You might have a deeper issue going on. (io contention?) –  Joel K Jul 1 '10 at 5:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.