【问题标题】:Get memory usage per domain in Varnish在 Varnish 中获取每个域的内存使用情况
【发布时间】:2020-10-29 14:19:44
【问题描述】:

我的服务器上有一个 Varnish 缓存,上面有 5 个不同的域。我可以使用 varnishstat 和 top 获得 Varnish 的总内存使用量。但是我想知道 Varnish 中每个域占用了多少内存?

【问题讨论】:

    标签: linux memory varnish


    【解决方案1】:

    这不会为您提供确切的内存,而是每个域的缓存使用情况。

    运行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)。

    【讨论】:

    • 太好了。我会试一试。一个问题:如果我频繁添加或删除域会怎样?我的意思是我应该在每次添加或删除域后重新启动还是重新加载就足够了?
    • 很遗憾,您需要为此重新启动
    【解决方案2】:

    除非您在单独的清漆进程上运行每个域,否则没有可用的方法来按域拆分它

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-08
    • 2023-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-24
    • 1970-01-01
    相关资源
    最近更新 更多