Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Apr 2004 18:17:50 -0500
From:      Jon Noack <noackjr@alumni.rice.edu>
To:        Aaron Seelye <aseelye-lists@eltopia.com>
Cc:        "Jim C. Nasby" <jim@nasby.net>
Subject:   Re: command piped into bzip not using all available CPU
Message-ID:  <4080699E.9060307@alumni.rice.edu>
In-Reply-To: <002701c42404$e9dbecf0$3102a8c0@metallus>
References:  <20040416220556.GL87362@nasby.net> <002701c42404$e9dbecf0$3102a8c0@metallus>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4080699E.9060307>