[Bug 219124] /var/db/services.db is extremely large for what it does

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon May 15 18:05:30 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219124

--- Comment #4 from Sean Bruno <sbruno at FreeBSD.org> ---
I'm guessing that this is an initialization problem.  The hash is being setup
to handle way more elements than is really needed in here.

% wc -l /etc/services 
    2495 /etc/services


HASHINFO hinfo = {
        .bsize = 256,
        .ffactor = 4,
        .nelem = 32768,
        .cachesize = 1024,
        .hash = NULL,
        .lorder = 0
};



If I change the HASHINFO to be slightly less over engineered (and less future
proof), I can get the *empty* services file down to 260k, but that's not really
a huge improvement for a basically empty file.  Should it be that big?  I
didn't really think I was going to have to go and learn berkley DB this week. 
:-)


Index: services_mkdb.c
===================================================================
--- services_mkdb.c     (revision 318297)
+++ services_mkdb.c     (working copy)
@@ -68,10 +68,10 @@
 static void    usage(void);

 HASHINFO hinfo = {
-       .bsize = 256,
-       .ffactor = 4,
-       .nelem = 32768,
-       .cachesize = 1024,
+       .bsize = 48,
+       .ffactor = 1,
+       .nelem = 4096,
+       .cachesize = 256,
        .hash = NULL,
        .lorder = 0
 };


-rw-r--r--  1 sbruno  sbruno  262720 May 15 12:04 services.db

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list