some questions/optimization ideas

Brad Fitzpatrick brad at danga.com
Mon Nov 13 18:03:12 UTC 2006


POSIX bloat fixed in svn 457.


On Tue, 7 Nov 2006, Hill, Greg wrote:

> 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
> along.
>
>
>
> Greg
>
>


More information about the mogilefs mailing list