【发布时间】:2020-10-29 14:19:44
【问题描述】:
我的服务器上有一个 Varnish 缓存,上面有 5 个不同的域。我可以使用 varnishstat 和 top 获得 Varnish 的总内存使用量。但是我想知道 Varnish 中每个域占用了多少内存?
【问题讨论】:
我的服务器上有一个 Varnish 缓存,上面有 5 个不同的域。我可以使用 varnishstat 和 top 获得 Varnish 的总内存使用量。但是我想知道 Varnish 中每个域占用了多少内存?
【问题讨论】:
这不会为您提供确切的内存,而是每个域的缓存使用情况。
运行varnishd,指定多个存储:
varnishd -s domain1=malloc,1G -s domain2=malloc,2G ...
在您的 VCL 中,根据域设置存储:
sub vcl_backend_response {
if (bereq.http.host == "domain1.example.com") {
set beresp.storage = domain1;
} else if {
set beresp.storage = domain2;
}
}
然后你可以使用:
varnishstat -1 -f SMA.domain1.g_bytes -f SMA.domain1.g_space
varnishstat -1 -f SMA.domain2.g_bytes -f SMA.domain2.g_space
查看每个商店使用了多少空间 (g_bytes) 和可用空间 (g_space)。
【讨论】:
除非您在单独的清漆进程上运行每个域,否则没有可用的方法来按域拆分它
【讨论】: