我尝试将DNS循环调度与nscd的dns缓存一起使用。但我不相信下面的话。
57hvy0tb1#
nscd
CACHE_PRUNE_INTERVAL
/nscd/nscd.h
test-nscd.apps.com
# # /etc/nscd.conf # # An example Name Service Cache config file. This file is needed by nscd. # # Legal entries are: # # logfile <file> # debug-level <level> # threads <initial #threads to use> # max-threads <maximum #threads to use> # server-user <user to run server as instead of root> # server-user is ignored if nscd is started with -S parameters # stat-user <user who is allowed to request statistics> # reload-count unlimited|<number> # paranoia <yes|no> # restart-interval <time in seconds> # # enable-cache <service> <yes|no> # positive-time-to-live <service> <time in seconds> # negative-time-to-live <service> <time in seconds> # suggested-size <service> <prime number> # check-files <service> <yes|no> # persistent <service> <yes|no> # shared <service> <yes|no> # max-db-size <service> <number bytes> # auto-propagate <service> <yes|no> # # Currently supported cache names (services): passwd, group, hosts # # logfile /var/log/nscd.log # threads 6 # max-threads 128 server-user nscd # stat-user nocpulse debug-level 0 # reload-count 5 paranoia no # restart-interval 3600 enable-cache passwd yes positive-time-to-live passwd 600 negative-time-to-live passwd 20 suggested-size passwd 211 check-files passwd yes persistent passwd yes shared passwd yes max-db-size passwd 33554432 auto-propagate passwd yes enable-cache group yes positive-time-to-live group 3600 negative-time-to-live group 60 suggested-size group 211 check-files group yes persistent group yes shared group yes max-db-size group 33554432 auto-propagate group yes enable-cache hosts yes positive-time-to-live hosts 300 negative-time-to-live hosts 20 suggested-size hosts 211 check-files hosts yes persistent hosts yes shared hosts yes max-db-size hosts 33554432
我做了什么实验1.从1个蝗虫工作站向test-nscd.apps.com发送TTL为1 ~ 60 s的流量,并检查PM 1、PM2上分布的流量1.从1 ~ 60个蝗虫工蜂向TTL为1的test-nscd.apps.com发送流量,并检查PM 1、PM2上分布的流量1.使用keepalive从1 ~ 60个Locus Worker向TTL为1的test-nscd.apps.com发送流量,并检查PM 1、PM2上分布的流量
tcpdump src port 53 -vvv
14:37:55.116675 IP (tos 0x80, ttl 49, id 41538, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain > test-client.39956: [udp sum ok] 9453 q: A? test-nscd.apps.com. 2/0/0 test-nscd.apps.com. [1m] A 10.130.248.64, test-nscd.apps.com. [1m] A 10.130.248.63 (83) -- 14:39:10.121451 IP (tos 0x80, ttl 49, id 20047, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain > test-client.55173: [udp sum ok] 6722 q: A? test-nscd.apps.com. 2/0/0 test-nscd.apps.com. [1m] A 10.130.248.63, test-nscd.apps.com. [1m] A 10.130.248.64 (83) -- 14:40:25.120127 IP (tos 0x80, ttl 49, id 28851, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain > test-client.39461: [udp sum ok] 40481 q: A? test-nscd.apps.com. 2/0/0 test-nscd.apps.com. [1m] A 10.130.248.63, test-nscd.apps.com. [1m] A 10.130.248.64 (83) --
16:14:04.359901 IP (tos 0x80, ttl 49, id 39510, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain >test-client.51466: [udp sum ok] 43607 q: A? test-nscd.apps.com. 2/0/0 test-nscd.apps.com. [5s] A 10.130.248.63, test-nscd.apps.com. [5s] A 10.130.248.64 (83) -- 16:14:19.361964 IP (tos 0x80, ttl 49, id 3196, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain >test-client.39370: [udp sum ok] 62519 q: A? test-nscd.apps.com. 2/0/0 test-nscd.apps.com. [5s] A 10.130.248.63, test-nscd.apps.com. [5s] A 10.130.248.64 (83) -- 16:14:34.364359 IP (tos 0x80, ttl 49, id 27647, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain >test-client.49659: [udp sum ok] 51890 q: A? test-nscd.apps.com. 2/0/0 test-nscd.apps.com. [5s] A 10.130.248.64, test-nscd.apps.com. [5s] A 10.130.248.63 (83) --
15:45:04.141762 IP (tos 0x80, ttl 49, id 30678, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain >test-client.35411: [udp sum ok] 63073 q: A?test-nscd.apps.com. 2/0/0test-nscd.apps.com. [15s] A 10.130.248.63,test-nscd.apps.com. [15s] A 10.130.248.64 (83) -- 15:45:34.191159 IP (tos 0x80, ttl 49, id 48496, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain >test-client.52441: [udp sum ok] 24183 q: A?test-nscd.apps.com. 2/0/0test-nscd.apps.com. [15s] A 10.130.248.63,test-nscd.apps.com. [15s] A 10.130.248.64 (83) -- 15:46:04.192905 IP (tos 0x80, ttl 49, id 32793, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain >test-client.49875: [udp sum ok] 59065 q: A?test-nscd.apps.com. 2/0/0test-nscd.apps.com. [15s] A 10.130.248.63,test-nscd.apps.com. [15s] A 10.130.248.64 (83) --
x1c4d 1x指令集
16:14:04.359901 IP (tos 0x80, ttl 49, id 39510, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain > test-client.51466: [udp sum ok] 43607 q: A?test-nscd.apps.com. 2/0/0test-nscd.apps.com. [5s] A 10.130.248.63,test-nscd.apps.com. [5s] A 10.130.248.64 (83) -- 16:14:19.361964 IP (tos 0x80, ttl 49, id 3196, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain > test-client.com.39370: [udp sum ok] 62519 q: A?test-nscd.apps.com. 2/0/0test-nscd.apps.com. [5s] A 10.130.248.63,test-nscd.apps.com. [5s] A 10.130.248.64 (83) -- 16:14:34.364359 IP (tos 0x80, ttl 49, id 27647, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain > test-client.com.49659: [udp sum ok] 51890 q: A?test-nscd.apps.com. 2/0/0test-nscd.apps.com. [5s] A 10.130.248.64,test-nscd.apps.com. [5s] A 10.130.248.63 (83) --
16:43:27.814701 IP (tos 0x80, ttl 49, id 28956, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain > test-client.49891: [udp sum ok] 22634 q: A?test-nscd.apps.com. 2/0/0 test-nscd.apps.com. [1s] A 10.130.248.63,test-nscd.apps.com. [1s] A 10.130.248.64 (83) -- 16:43:42.816721 IP (tos 0x80, ttl 49, id 27128, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain > test-client.34490: [udp sum ok] 37589 q: A?test-nscd.apps.com. 2/0/0test-nscd.apps.com. [1s] A 10.130.248.63,test-nscd.apps.com. [1s] A 10.130.248.64 (83) -- 16:43:57.842106 IP (tos 0x80, ttl 49, id 60723, offset 0, flags [none], proto UDP (17), length 111) 10.230.167.65.domain > test-client.55185: [udp sum ok] 1139 q: A?test-nscd.apps.com. 2/0/0test-nscd.apps.com. [1s] A 10.130.248.63,test-nscd.apps.com. [1s] A 10.130.248.64 (83)
指令集
文件
1条答案
按热度按时间57hvy0tb1#
总结
nscd
在DNS查询时遵守TTL时间,但短于15秒的TTL时间似乎与15秒的TTL时间相同。这是因为nscd
至少每隔15秒修剪一次其缓存,这被定义为CACHE_PRUNE_INTERVAL
在/nscd/nscd.h
CACHE_PRUNE_INTERVAL
,可以通过DNS循环将流量不均匀地分配到域后面的服务器。详细介绍
环境
test-nscd.apps.com
。其TTL:1~ 60秒我做了什么实验
1.从1个蝗虫工作站向
test-nscd.apps.com
发送TTL为1 ~ 60 s的流量,并检查PM 1、PM2上分布的流量1.从1 ~ 60个蝗虫工蜂向TTL为1的
test-nscd.apps.com
发送流量,并检查PM 1、PM2上分布的流量1.使用keepalive从1 ~ 60个Locus Worker向TTL为1的
test-nscd.apps.com
发送流量,并检查PM 1、PM2上分布的流量测试结果
1.从1个蝗虫工作者发送TTL为1 ~ 60 s的流量到
test-nscd.apps.com
,并检查分布在PM 1、PM2的流量tcpdump src port 53 -vvv
可以看到客户端(worker)每隔60~ 75秒从dns服务器获得一次dns回复x1c4d 1x指令集
2.从1 ~ 100个蝗虫工作者向TTL为1的
test-nscd.apps.com
发送流量,并检查分布在PM 1、PM2的流量指令集
3.使用keepalive从1 ~ 100个Locus Worker向TTL为1的
test-nscd.apps.com
发送流量,并检查PM 1、PM2上分布的流量4.(对比实验)发送流量到绑定在机器JVM上的
test-nscd.apps.com
(JVM有自己的dns缓存),并检查流量分布在PM 1、PM2指令集
指令集
文件
结论
nscd
在DNS查询时遵守TTL时间。但比15 s短的TTL看起来像15 s一样工作,因为nscd
至少每隔15 s修剪其缓存,这被定义为CACHE_PRUNE_INTERVAL
在/nscd/nscd.h
。您可以从下面找到这一事实。CACHE_PRUNE_INTERVAL
,可以通过DNS轮循将流量不均匀地分配到域后面的服务器上,相比JVM的dns缓存,nscd很难使用DNS轮循。