Apache-Backhand
view release on metacpan or search on metacpan
Backhand.pm view on Meta::CPAN
print $server->{'mtime'}, "\n";
$server->{'load'} += 1;
}
Note that each of the elements of the hashes is magically tied directly (for
both reads and writes) into the shared memory segment where serverstats
resides. You can call load_serverstats() once, and use the returned structure
as much as you want - it will always reflect the contents of the underlying
shared structure. This has one drawback, however, which is that you cannot
call load_serverstats() until after the shared memory segment has been created
and attached. I recommend a PerlChildInit handler to do load_serverstats()
into a global variable.
=item B<load_personal_arriba>
This function returns a reference to a scalar variable which is magically
tied to the global mod_backhand_personal_arriba integer. This contains the
arriba speed of the local machine.
=back
=head1 CAVEATS
As explained above, you cannot PerlModule or use() or require()
Apache::Backhand until *after* mod_backhand (and mod_perl, of course) are
linked into the server.
As explained above, you cannot call load_serverstats() until *after* the
shared memory segment has been created and attached. The best place to do
this is the child init phase.
It's easy to make mod_backhand coredump by doing Bad Things to serverstats
(e.g. 'foreach (@{$serverstats}) { $_->{'mtime'} = time() }'...)
Even though I've provided the magic to make serverstats writeable, this should
be treated with care.
There is necessarily going to be a small amount of overhead when calling perl
candidacy functions. I highly recommend calling byAge *before* calling any
perl candidacy functions, because converting the server list into a perl array
( run in 0.837 second using v1.01-cache-2.11-cpan-e1769b4cff6 )