[OpenAFS-devel] token/pag cleanup on i386_linux*
Neulinger, Nathan
nneul@umr.edu
Mon, 11 Jun 2001 12:07:37 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C0F299.03EF5AF0
Content-Type: text/plain;
charset="ISO-8859-1"
I've attached the script I use on linux... We run this every 15-30 minutes
(could run less frequently w/o any negative effect) and it does a excellent
job keeping the pags under control. Might not be perfect, but it beats
rebooting machine all the time.
-- Nathan
> -----Original Message-----
> From: David Thompson [mailto:thomas@cs.wisc.edu]
> Sent: Monday, June 11, 2001 12:02 PM
> To: Neulinger, Nathan
> Cc: 'openafs-devel@openafs.org'
> Subject: Re: [OpenAFS-devel] token/pag cleanup on i386_linux*
>
>
>
> Yeah I'd be interested. We are pondering an
> afs-authenticated web server for
> some of our needs. The "1 pag per second" rule and the performance
> degredation under thousands of pags make recycling of pags
> necessary, but I
> didn't think you could scan the whole process table
> effeciently enough to be
> useful. I'm thinking of a list of "known pags" that could be
> allocated, used,
> and later reused when all the processes using them are known
> to be gone.
> Anyone gotten further into this?
>
> I would really like to see the GCPAGS code enabled if
> possible for other
> things, but it won't help us for this. We need the *web
> server* (not the afs
> client) to verify that no processes are using a given pag anymore.
>
> "Neulinger, Nathan" wrote:
> >On my heavy-authentication-activity clients, I have to run a
> token cleanup
> >script that gets rid of tokens for processes that have gone
> away/etc. It's
> >my understanding that the GCPAGS code does this
> automatically. What is
> >preventing this from being enabled on linux?
> >
> >(If anyone wants the script, I'll be happy to send it to
> you, it uses a
> >combination of processing kdump output and examining
> auxgroup membershup
> >from /proc.)
> >
> >If you don't run this, and you have a server that does a lot of token
> >activity, you get into a situation where the afs_users
> structure in the
> >kernel is HUGE and very very very slow, which impacts
> everything on the
> >machine. I'm running scripts to handle this on hpux (poorly)
> and linux.
> >
> >-- Nathan
> >
> >------------------------------------------------------------
> >Nathan Neulinger EMail: nneul@umr.edu
> >University of Missouri - Rolla Phone: (573) 341-4841
> >Computing Services Fax: (573) 341-4216
> >_______________________________________________
> >OpenAFS-devel mailing list
> >OpenAFS-devel@openafs.org
> >https://lists.openafs.org/mailman/listinfo/openafs-devel
>
>
------_=_NextPart_000_01C0F299.03EF5AF0
Content-Type: application/octet-stream;
name="clean-tokens-redhat.pl"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="clean-tokens-redhat.pl"
#!/umr/bin/perl=0A=
$| =3D 1;=0A=
=0A=
# =0A=
# Input sources=0A=
#=0A=
chomp($ver =3D `uname -r`);=0A=
$in_kdump =3D "/usr/afsws/etc/kdump-$ver -users|";=0A=
$in_ps =3D "/bin/ps -ef|";=0A=
=0A=
#=0A=
# Read in the kdump data=0A=
#=0A=
open(IN, $in_kdump);=0A=
print "Processing KDump: ";=0A=
$count =3D 0;=0A=
%pags =3D ();=0A=
%pags_per_uid =3D ();=0A=
while ( $line =3D <IN> )=0A=
{=0A=
next if ( $line !~ /:/o );=0A=
=0A=
if ( $line =3D~ /uid=3Dx(41[0-9a-fA-F]+),.*vid=3D([0-9]+)/o )=0A=
{=0A=
$pag =3D $1;=0A=
$uid =3D $2;=0A=
=0A=
$pagnum =3D hex($pag) - hex("41000000");=0A=
$pag2 =3D $pagnum % 16384;=0A=
$pag1 =3D ($pagnum-$pag2)/16384;=0A=
=0A=
$pag1 +=3D 33536;=0A=
$pag2 +=3D 32512;=0A=
=0A=
if ( $uid > 0 )=0A=
{=0A=
$pags{"$pag1:$pag2"} =3D $uid;=0A=
print "\t$pag1,$pag2\n";=0A=
}=0A=
=0A=
# if ( $count % 250 =3D=3D 0 ) { print "." };=0A=
$count++;=0A=
}=0A=
}=0A=
print "$count active tokens.\n";=0A=
close(IN);=0A=
=0A=
#=0A=
# Read in the info about active processes, delete from=0A=
# %pags for each active=0A=
#=0A=
print "Scanning processes:\n";=0A=
opendir(DIR, "/proc");=0A=
while ( $file =3D readdir(DIR) )=0A=
{=0A=
next if ( $file !~ /^[0-9]+$/o );=0A=
print "\t$file: ";=0A=
=0A=
$groups =3D "";=0A=
=0A=
open(IN, "/proc/$file/status");=0A=
while ( chomp($line =3D <IN>) )=0A=
{=0A=
if ( $line =3D~ /^Groups:(.*)$/o )=0A=
{=0A=
$groups =3D $1;=0A=
last;=0A=
}=0A=
}=0A=
close(IN);=0A=
=0A=
$groups =3D~ s/[\r\n\t ]+/ /gio;=0A=
$groups =3D~ s/^ +//gio;=0A=
$groups =3D~ s/ +$//gio;=0A=
@groups =3D split(' ', $groups);=0A=
=0A=
$pag1 =3D $groups[0];=0A=
$pag2 =3D $groups[1];=0A=
=0A=
if ( $pag1 >=3D 32512 && $pag2 >=3D 33536 )=0A=
{=0A=
print "$pag1,$pag2 ";=0A=
if ( $pags{"$pag1:$pag2"} )=0A=
{=0A=
print "skipping pag\n";=0A=
delete $pags{"$pag1:$pag2"}; =0A=
}=0A=
else=0A=
{=0A=
print "no active token\n";=0A=
}=0A=
}=0A=
else=0A=
{=0A=
print "not active pag\n";=0A=
}=0A=
}=0A=
=0A=
closedir(DIR);=0A=
=0A=
#=0A=
# Clean pags=0A=
#=0A=
$cleaned =3D 0;=0A=
$skipped =3D 0;=0A=
$count =3D 0;=0A=
while ( ($pag,$uid) =3D each(%pags) )=0A=
{=0A=
if ( $count % 100 =3D=3D 0 )=0A=
{=0A=
print "Processed Tokens: $count\n";=0A=
}=0A=
$count++;=0A=
=0A=
=0A=
($pag1, $pag2) =3D split(/:/, $pag);=0A=
$) =3D "0 $pag1 $pag2";=0A=
system("/usr/afsws/bin/unlog");=0A=
$cleaned++;=0A=
=0A=
print "\t$pag unlogged\n";=0A=
}=0A=
print "Cleaning Tokens: $cleaned tokens unlogged.\n";=0A=
------_=_NextPart_000_01C0F299.03EF5AF0--