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 02-19-2009, 11:31 AM   #1
wastingtime
Member
 
Registered: Sep 2004
Posts: 86

Rep: Reputation: 17
How can I limit a process' disk io bandwith


I need to run an archiving process that is cpu and disk io intensive.

It is easy to make sure it does not steal the cpu from more important processes: nice myprocess

However, even when running at a lower priority (thanks to nice) it manages to generate enough disk io to impact the performance of more important processes.

I would like to be able to limit the process disk io to e.g. 10Mbyte/sec; alternatively, to 10% of the available bandwidth.

ulimit does not seem to have such option.

Is there another command ?

Can I do that programmatically (i.e. write my own command ... but then someone must have wrote one already)?
 
Old 02-19-2009, 12:47 PM   #2
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
The usual answer here is to run the archive as a cron job. Set it to run at 2am (or whenever the machine has little use) and that way you can give it all the resources it wants without interfering with your daily tasks.
 
Old 02-19-2009, 01:04 PM   #3
wastingtime
Member
 
Registered: Sep 2004
Posts: 86

Original Poster
Rep: Reputation: 17
This machine runs 24X7
 
Old 02-20-2009, 12:22 AM   #4
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by wastingtime View Post
I need to run an archiving process that is cpu and disk io intensive.

It is easy to make sure it does not steal the cpu from more important processes: nice myprocess

However, even when running at a lower priority (thanks to nice) it manages to generate enough disk io to impact the performance of more important processes.

I would like to be able to limit the process disk io to e.g. 10Mbyte/sec; alternatively, to 10% of the available bandwidth.

ulimit does not seem to have such option.

Is there another command ?

Can I do that programmatically (i.e. write my own command ... but then someone must have wrote one already)?
What about following:

Create shared library slow_io.so with functions read and write.
Those funcion should usleep(your_timeout) and then call, original one

Run your application as
Code:
LD_PRELOAD=slow_io.so YourApplication
You may also need to intercept other io syscalls, such as pread/pwrite
 
Old 02-20-2009, 01:18 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
"man ionice"
 
Old 02-20-2009, 01:21 AM   #6
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by syg00 View Post
"man ionice"
Cool. Never hear about it before
 
Old 02-21-2009, 12:31 PM   #7
wastingtime
Member
 
Registered: Sep 2004
Posts: 86

Original Poster
Rep: Reputation: 17
just what i need, only available from 2.6.13 and up though.
 
  


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
Limit bandwith on interface Tux-Slack Slackware 1 02-06-2008 02:27 PM
Limit disk I/O for a process matiasquestions Linux - Software 3 01-26-2006 09:50 AM
Iptables Bandwith Limit av0 Linux - Networking 4 03-29-2004 06:36 AM
configuring bandwith limit on RH8 maxut Linux - Networking 2 08-15-2003 02:47 AM
Limit bandwith for routers Xenoide Linux - Networking 2 04-24-2002 07:37 AM

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

All times are GMT -5. The time now is 12:19 AM.

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