Gentoo io-limiter for big upgrades (glibc)

I know that someone posted a script for making gentoo not completely murder itself while doing major upgrades (like glibc) by limiting I/O … I can't find that now, anyone care to venture how to do this?

8 Replies

@Jay:

I know that someone posted a script for making gentoo not completely murder itself while doing major upgrades (like glibc) by limiting I/O … I can't find that now, anyone care to venture how to do this?

The general idea was something like:

while true

do

$x = `awk '{print $6}' FS='[ =]'
[ $x -lt 100000 ] && kill -stop $PID

[ $x -gt 200000 ] && kill -cont $PID

sleep 5

done

Okay… how would I implement that into my emerge then?

@Jay:

Okay… how would I implement that into my emerge then?
Well, you could go about it this way, but I'm sure there's plenty of other ways to do it as well…

First, you could change it to take $1 instead of $PID (or $PID = $1) to take the process ID from the first command line argument in your script, then when you run your emerge, the PID will be output if you toss it in the background ("emerge -u glibc &"), then you can type "./iopeyes ###" (replacing ### with the PID output from the last command) assuming you cleverly name your script the same way I would.

And if you wanted to take it a couple more steps, these couple ideas might give you a good reason to learn some BASH scripting and not have to ask that question again in the future:

1. Add output info to let you know when the process isn't found anymore (it finished), as well as when it's being stopped/started.

2. Add a break and quit when the process isn't found anymore so it takes care of itself cleanly and then you can toss that last command in the background as well and forget about it.

@sednet:

@Jay:

I know that someone posted a script for making gentoo not completely murder itself while doing major upgrades (like glibc) by limiting I/O … I can't find that now, anyone care to venture how to do this?

The general idea was something like:

while true

do

$x = `awk '{print $6}' FS='[ =]'
[ $x -lt 100000 ] && kill -stop $PID

[ $x -gt 200000 ] && kill -cont $PID

sleep 5

done

I threw that into a foo.sh file (i manually subbed in a PID) with the #!/bin/sh … it kept erroring out.

> First, you could change it to take $1 instead of $PID (or $PID = $1) to take the process ID from the first command line argument in your script, then when you run your emerge, the PID will be output if you toss it in the background ("emerge -u glibc &"), then you can type "./iopeyes ###" (replacing ### with the PID output from the last command) assuming you cleverly name your script the same way I would.

That doesn't work b/c it's really the child processes of emerge that cause all the IO pain.

@sednet:

The general idea was something like:

while true

do

$x = `awk '{print $6}' FS='[ =]'
[ $x -lt 100000 ] && kill -stop $PID

[ $x -gt 200000 ] && kill -cont $PID

sleep 5

done

That third line should be:

x = `awk '{print $6}' FS='[ =]'

Further proof that perl warps your mind.

If you change the kill's to a loop that stops or conts everything with emerge or cc in its name it should do what you want.

why not just do the build on your more powerful home pc and then upload the binary packages and then have portage install your binaries?

I made a HOWTO on this very subject ;)

http://www.linode.com/forums/viewtopic.php?t=1688

@sednet:

If you change the kill's to a loop that stops or conts everything with emerge or cc in its name it should do what you want.

It would be nice if that code was just magically written, by some nice person

whistles innnocently

@Jay:

It would be nice if that code was just magically written, by some nice person

O-kay…

Open two ssh sessions, one for the control script and one for the emerge.

make a note of the pts doing the emerge stuff ( ie by typing w and looking for the pts running the w command. )

Run the following in bash in the control window:

emergepts= <the number="" of="" the="" pts="" running="" emerge="">#high and low points
low=100000
high=200000
sleeptime=10
while true 
do
  x = `awk '{print $6}' FS='[ =]'</the> 

That should work but its totally untested and I guarantee nothing.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct