开发者

Average CPU usage not fully utilized [closed]

开发者 https://www.devze.com 2023-03-16 16:29 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

We have created a multi-threaded application which process/parse big files (few hundred MB's) simultaneously. Application runs perfectly. But my client is disappointed the way cores of machine being used. He tried to watch the performance moni开发者_如何学JAVAtor and came to us with report. His point is if application is multi-threaded why CPU average utilization is below 25%. According to him, if nothing is running on system and file processing is taking time, CPU utilization should be more than 80-90%. I am not sure what answer or technical outcome will satisfy him. Please suggest.

EDIT

I have one multi-threaded application which loads the file from disc. After file is loaded in memory, i click on process button, and it starts parsing the file in memory. Lets assume for now, parsing is done in one thread. While app is parsing the data, my average CPU usage not fully used. What reason I can give to justify why CPU is not completely used. Any kind of report will do or technical documentation will help.


The question is very vague, but here are some general guidelines.

Disk IO is the main bottleneck unless the file processing is really fancy. Loading several files simultaneously will make this even worse, as the head needs to jump around (for non-SSD drives), and data will come into memory even slower. If you load four files at 100 MB each, that would already take around 4 seconds when done serially - and longer when done in parallel. Your program might or might not wait during that time and just don't process data at all.

So if your parallelization is mainly to process several files (one file per worker thread), then you might want to serialize the loading in one thread.

If you can work one file at a time, maybe your processing can be split up to work on different parts of the file, or the processing itself can take advantage of multiple CPUs (largely depends on your application).

If you need to write back data to disk - then this will be part of the game, too.

I think the main point here is minimizing IO delay (and a reasonable splitting of the workload between different CPUs).

Edit:

Of course take RAM into account - if you need to swap out, this will kill your performance instantly.

The best way is of course to go and profile...

0

精彩评论

暂无评论...
验证码 换一张
取 消