dscacheutil 返回 (几乎) 空的缓存是否正常?我在 10.5.8 上尝试了相同的 -cachedump 命令,并获得了我预期看到的内部和外部主机列表。
在启动 FileMaker 数据库之后,gethostbyname 出现了约 150 万次缓存未命中,该数据库在 10.5.8 上需要不到 30 秒的时间打开,但在 10.6.6 上则需要 5 分钟以上的时间。
dscacheutil-统计信息
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
答案1
从我这里的机器来看,它看起来像一个正常的配置文件
机器 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
机器 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