some questions/optimization ideas

Hill, Greg grhill at
Tue Nov 7 21:39:36 UTC 2006

I'm starting to familiarize myself with the code a bit, as I'll be
working on integrating memcached into mogilefs (Earl, my boss, emailed
the list previously about that).  Anyway, I just noticed something that
you might want to reconsider.  In mogilefsd, you have:

use POSIX;


The POSIX module exports all of its functions by default, adding over
1MB to each process (discovered this when profiling memory usage at a
previous employer).  It'd be better to specify which functions you want
to import, or even better to import none and just refer to them using
the namespace.


1MB isn't really a huge deal, but considering you probably only make use
of a few POSIX functions, it's quite wasteful. (in the case where I
discovered it, we were only using 2 functions).


Another thing I noticed, albeit not really important:


In 'validate_dbh' you have:


        my $id = $dbh->selectrow_array("SELECT CONNECTION_ID()");

        if (! $id) {

            # handle's dead.  don't use it.  (MySQL-ism above)

            undef $dbh;



While you could just do:

if (! $dbh->ping) {
            undef $dbh;



That would make it more database agnostic.  Or maybe you had a good
reason for doing it the other way.


Maybe you don't care about either of those, but I thought I'd pass them



-------------- next part --------------
An HTML attachment was scrubbed...

More information about the mogilefs mailing list