command piped into bzip not using all available CPU

Jon Noack noackjr at alumni.rice.edu
Fri Apr 16 16:17:58 PDT 2004


On 4/16/2004 5:48 PM, Aaron Seelye wrote:
> I would venture a guess that bzip is not multi threaded and therefore
> isn't spreading the load around.

I think you may be right.  I tested this on my dual Pentium III 933 
running 5.2.1-RELEASE-p5.  bzip2 behaves like this while gzip behaves as 
expected.  I know top sucks for measuring performance, but it should be 
accurate enough for the big picture.

Here's the simple test with bzip2 (the rand() is to give perl "work"):
perl -e 'do{print rand();}while 1' | bzip2 > /dev/null
**********************************************************************
last pid: 83786;  load averages:  0.53,  0.31,  0.19    up 4+03:06:50 
17:54:52
92 processes:  2 running, 90 sleeping
CPU states: 52.0% user,  0.0% nice, 11.1% system,  0.4% interrupt, 36.5% 
idle
Mem: 222M Active, 154M Inact, 99M Wired, 22M Cache, 60M Buf, 2140K Free
Swap: 1024M Total, 176K Used, 1024M Free

   PID USERNAME PRI NICE   SIZE    RES STATE  C   TIME   WCPU    CPU COMMAND
83784 noackjr  106    0  8804K  7280K CPU0   0   0:22 60.19% 49.76% bzip2
83783 noackjr   -8    0  2756K  1908K pipdwt 0   0:14 38.87% 32.13% perl
**********************************************************************

This time with gzip (with -9 to make gzip work harder):
perl -e 'do{print rand();}while 1' | gzip -9 > /dev/null
**********************************************************************
last pid: 83865;  load averages:  1.11,  0.41,  0.28    up 4+03:18:11 
18:06:13
91 processes:  4 running, 87 sleeping
CPU states: 90.7% user,  0.0% nice,  1.6% system,  0.0% interrupt,  7.7% 
idle
Mem: 215M Active, 155M Inact, 99M Wired, 19M Cache, 60M Buf, 10M Free
Swap: 1024M Total, 176K Used, 1024M Free

   PID USERNAME PRI NICE   SIZE    RES STATE  C   TIME   WCPU    CPU COMMAND
83864 noackjr  117    0  2756K  1908K CPU0   0   0:32 88.37% 73.05% perl
83865 noackjr  116    0  1696K   960K RUN    0   0:30 84.65% 69.97% gzip
**********************************************************************

On a moderately-related note, -CURRENT recently got some pipe updates 
(up to 75% bandwidth increase on i386):
http://lists.freebsd.org/pipermail/cvs-src/2004-March/021197.html

Jon Noack



More information about the freebsd-performance mailing list