dscacheutil shows an empty cache?

5,234

From the machines I have here it looks like a normal profile

Machine 1

     Procedure   Cache Hits   Cache Misses   External Calls
------------------   ----------   ------------   --------------
          getpwnam         1714             46             1760
          getpwuid         5746             94             5840
          getgrnam          129             55              184
          getgrgid            7             24               31
     getservbyname        34238             72               98
     getservbyport            0             10               10
    getprotobyname           71              8               79
  getprotobynumber           15              0               15
          getfsent            0              0               11
         getnetent            0              0                1
      getnetbyname            0              2                2
      getnetbyaddr            1              4                5
     gethostbyname            4          34789               26
     gethostbyaddr            0            366              366
gethostbyname_service            0              0            34767
       _flushcache            0              0                5

Machine 2

Statistics by procedure:

             Procedure   Cache Hits   Cache Misses   External Calls
    ------------------   ----------   ------------   --------------
              getpwnam        33929           1530            35459
              getpwuid        20118           1171            21289
              getgrnam         2649           1314             3963
              getgrgid          118             83              201
         getservbyname         1543            642             1599
        getprotobyname           42             70              112
      getprotobynumber           45             33               78
              getfsent            0              0               19
             getnetent            0              0                6
          getnetbyname            8              4               12
          getnetbyaddr            0             34               34
         gethostbyname            0           9194             8021
         gethostbyaddr            0            156              156
    gethostbyname_service            0              0             1173
Share:
5,234

Related videos on Youtube

Dale Reidy
Author by

Dale Reidy

Code all the things

Updated on September 17, 2022

Comments

  • Dale Reidy
    Dale Reidy almost 2 years

    Is it normal for dscacheutil to return an (almost) empty cache? I tried the same -cachedump command on 10.5.8 and I got a list of internal and external hosts as I'd expected to have seen.

    The 1.5~ million cache misses for gethostbyname was after firing up a FileMaker database that opens in sub 30s on 10.5.8 but takes over 5 minutes in 10.6.6.

    dscacheutil -statistics

    Overall Statistics:
      Average Call Time     - 0.001025
      Cache Hits            - 1533905
      Cache Misses          - 3063347
      Total External Calls  - 1539214
    
    Statistics by procedure:
    
             Procedure   Cache Hits   Cache Misses   External Calls
    ------------------   ----------   ------------   --------------
              getpwnam          542            129              671
              getpwuid         6242            510             6752
              getgrnam          106            175              281
              getgrgid            6             32               38
         getservbyname      1527001            661               63
              getfsent            0              0              193
          getnetbyaddr            0             35               35
         gethostbyname            8        1530311             1950
         gethostbyaddr            0            861              861
    gethostbyname_service            0              0          1528369
    

    sudo dscacheutil -cachedump -entries

    DirectoryService Cache Overview:
    AAAA Queries  - Disabled (link-local IPv6 addresses)
    Cache Size    - 8
    
    Entry count by category:
        Group    - 3
        Service  - 1
        User     - 4
    
    Cache entries (ordered as stored in the cache):
    
      Category         Best Before         Last Access      Hits    Refs       TTL    Neg  DS Node
    ----------  ------------------  ------------------  --------  ------  --------  -----  ---------
          User   01/26/11 11:08:31   01/26/11 10:45:38       124       1      3600         /Local/Default
                     Key: pw_name:dale
                     Key: pw_uid:502
    
         Group   01/26/11 11:09:28   01/26/11 10:09:28         0       1      3600         /Local/Default
                     Key: gr_uuid:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000009
                     Key: gr_gid:9
                     Key: gr_name:procmod
    
         Group   01/26/11 11:09:28   01/26/11 10:09:28         0       1      3600         /Local/Default
                     Key: gr_name:procview
                     Key: gr_uuid:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000008
                     Key: gr_gid:8
    
       Service   01/26/11 11:09:45   01/26/11 10:44:38         1       1      3600         /BSD/local
                     Key: s_name:ipp
                     Key: s_name:ipp s_proto:udp
                     Key: s_port:631 s_proto:udp
    
          User   01/26/11 11:09:46   01/26/11 10:43:34        21       1      3600         /Local/Default
                     Key: pw_name:spotlight
                     Key: pw_name:_spotlight
                     Key: pw_uid:89
    
         Group   01/26/11 11:43:53   01/26/11 10:43:53         0       1      3600         /Local/Default
                     Key: gr_name:tty
                     Key: gr_gid:4
                     Key: gr_uuid:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000004
    
          User   01/26/11 11:44:38   01/26/11 10:44:38         0       1      3600         /Local/Default
                     Key: pw_name:root
                     Key: pw_uid:0
    
          User   01/26/11 11:44:38   01/26/11 10:44:39         1       1      3600         /Local/Default
                     Key: pw_gecos:Unprivileged User
                     Key: pw_name:nobody
                     Key: pw_uid:-2
    
  • lynxman
    lynxman over 13 years
    Mac OS X 10.6.6 on both machines and no host records either, but that's due to Mac OS X 10.6.x separating the DNS cache from the general DS database, for that now you should check the internal DB of mDNSResponder, you can get a full list of the cache hosts there by running sudo killall -INFO mDNSResponder, all the info will be dumped into /var/log/system.log