LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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
 
LinkBack Search this Thread
Old 02-19-2009, 11:31 AM   #1
wastingtime
Member
 
Registered: Sep 2004
Posts: 77

Rep: Reputation: 16
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,362

Rep: Reputation: 171Reputation: 171
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: 77

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

Rep: Reputation: 132Reputation: 132
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: 11,795

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

Rep: Reputation: 132Reputation: 132
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: 77

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are 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


All times are GMT -5. The time now is 08:02 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration