Future development of Jail
Rudy
crapsh at monkeybrains.net
Thu Jan 31 01:47:06 PST 2008
Karl Triebes wrote:
> I would like to see per-jail quotas such as the ones Andy mentions,
> and would like to hear if anyone would be interested in doing it for
> the right price. You may contact me via this list or in private.
Per-jail quotas are Trivial you use zfs... You can even resize a zfs mount 'on the fly'.
Here is the command to resize a jail to 100GB of space::
# zfs set quota=100G tank/jails/myNeatoWebsite
As for doing it for a price, I'll consult -- granted I just let The Secret out of the bag. :)
I can build a 1TB to 6TB box for you and have it all set and ready for jails, or you could do it
yourself.
As for CPU, I 'auto nice' pids with high CPU usage:
#!/usr/local/bin/perl
# This is BEERWARE [b] Rudy
# auto-nice-jails.pl - set this up in cron to run every 5 minutes
#use strict;
open PS, "/bin/ps -axo time,pid,nice,state,command | /usr/bin/sort -nr |" or die "no PS for me.
$). $!";
while (<PS>) {
# examples:
#191:49.16 0 R+J ./q3ded +set fs_game arena +set vm_game 0 +set sv_pure ...etc...
# 21:23.58 4 RN+J ./sc_serv
/^\s*(\d+):(\d+).\d+\s+(\d+)\s+(\d+)\s+(\S+)\s+(.*)$/ or next;
my ($cputime,$pid,$nice,$state,$command) = (($1*60+$2),$3,$4,$5,$6);
### print "($cputime,$pid,$nice,$state,$command)\n";
last if ($cputime < 30);
next unless ($state =~ /J/); # only jailed procs...
next if ($nice > 5);
my $renice = 2;
$renice = 4 if ($cputime > 1000);
$renice = 5 if ($cputime > 10000);
if ($renice > $nice) {
print "$pid\t$nice\t$cputime\t$command\n";
system("/usr/bin/renice +$renice $pid");
}
}
Rudy
More information about the freebsd-questions
mailing list