LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-20-2006, 03:03 PM   #1
chovy
Member
 
Registered: Dec 2004
Location: Capitola, CA
Distribution: Debian
Posts: 52

Rep: Reputation: 15
gzip using too much CPU


So I have this problem with my virtual host provider.
Gzipping a large file 260meg results in 99% CPU usage, and my session gets killed.

Any ideas around this?

I wanted to gzip a 260mb .sql file (a dump from mysqldump).

'nice' doesn't seem to work even at --adjustment=19.
 
Old 01-20-2006, 04:23 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
You could get the PID of the gzip, and issue a SIGSTOP to it (with kill -STOP), then sleep for a second, then issue a SIGCONT to it (with kill -CONT), then sleep for a second, then issue a SIGSTOP to it.......

That should effectively half your processor time. Adjust the sleeps to taste.

Dave

Last edited by ilikejam; 01-20-2006 at 04:25 PM.
 
Old 01-20-2006, 04:26 PM   #3
chovy
Member
 
Registered: Dec 2004
Location: Capitola, CA
Distribution: Debian
Posts: 52

Original Poster
Rep: Reputation: 15
So there's no real coreutils utility to do this for me?

Is there any way to control the pipe or buffer, whatever gzip uses?

$gzip bigfile.sql smallfile.sql.gz

This will eat up all the memory on the server, I'm surprised if there's no way to control it and play "nicely".

Last edited by chovy; 01-20-2006 at 04:27 PM.
 
Old 01-20-2006, 04:41 PM   #4
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
I don't know of any core utils which will control processor usage (except for nice). Most people like their computers to run as fast as possible, so it's not an oft-requested feature to slow down processes arbitrarily.

gzip usually doesn't eat up RAM (it allocates and deallocates quite small chunks as it goes along), so I wouldn't worry about that. (I just tried gzip'ing a 400MB file, and memory usage never went above 0.1% on a 512MB RAM machine).

Dave
 
Old 01-20-2006, 04:45 PM   #5
chovy
Member
 
Registered: Dec 2004
Location: Capitola, CA
Distribution: Debian
Posts: 52

Original Poster
Rep: Reputation: 15
When I run gzip on a 260mb I get kicked off, even other ssh connections to the ISP server.

The mem usage goes up to 99.9%
 
Old 01-20-2006, 04:46 PM   #6
chovy
Member
 
Registered: Dec 2004
Location: Capitola, CA
Distribution: Debian
Posts: 52

Original Poster
Rep: Reputation: 15
aiyyy...it IS CPU usage that goes up to 99.9% not ram.
 
Old 01-20-2006, 04:47 PM   #7
chovy
Member
 
Registered: Dec 2004
Location: Capitola, CA
Distribution: Debian
Posts: 52

Original Poster
Rep: Reputation: 15
I tried
$ nice --adjustment=19 gzip test.sql

and i get kicked everytime.
 
Old 01-21-2006, 07:24 PM   #8
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi again.

Have you tried the STOP-sleep-CONT thing in post #2?

Dave
 
Old 01-21-2006, 07:40 PM   #9
chovy
Member
 
Registered: Dec 2004
Location: Capitola, CA
Distribution: Debian
Posts: 52

Original Poster
Rep: Reputation: 15
I think it was a combination of gzip --fast and ssh -o TCPKeepAlive=yes

that fixed the problem, at least temporarily for me.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Solaris 8 gzip issues- cannot gzip -d lynx sixosix Solaris / OpenSolaris 4 03-13-2005 03:17 PM
gzip cuco76 Linux - Newbie 2 11-21-2003 10:09 PM
gzip Robin01 Linux - Newbie 4 09-13-2003 04:57 AM
Gzip InfoLock Linux - Software 4 09-02-2003 08:20 AM
Gzip futurist General 7 03-29-2002 03:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:08 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