【问题标题】:Nginx proxy cache purge process does not clean up items fast enough for new elementsNginx 代理缓存清除过程没有足够快地为新元素清理项目
【发布时间】:2020-02-02 18:54:36
【问题描述】:

我们的对象存储前面有一个 nginx,用于缓存大型对象。对象大至 100GB。 nginx 缓存最大大小设置为大约 3.5TB。

当大对象请求激增并且磁盘快速填满时,nginx会遇到磁盘空间不足的错误。我期待缓存管理器基于 LRU 清除项目并为新元素腾出空间,但这并没有发生。

我可以用一个简单的测试用例重现问题:

配置:

proxy_cache_path /tmp/cache levels=1:2 keys_zone=cache_one:256m inactive=2d max_size=16G use_temp_path=off;

测试:

  1. 运行请求以下载 15GB 的文件,该文件已正确提供并存储在缓存中。
  2. 运行第二个请求以下载 10GB 的不同文件,它将失败并显示如下内容:
2019/10/04 11:49:08 [crit] 20206#20206: *21 pwritev() "/tmp/cache/9/fa/a301d42ca6e5d4188c38ecf56aa3afa9.0000000001" has written only 221184 of 229376 while reading upstream, client: 127.0.0.1, server: eos_cache_filer, request: "GET...
2019/10/04 12:07:29 [crit] 21201#21201: *487 pwrite() "/tmp/cache/9/fa/a301d42ca6e5d4188c38ecf56aa3afa9.0000000002" failed (28: No space left on device) while reading upstream, client: 127.0.0.1, server: eos_cache_filer, request: 

我可以调整一些 cache_manager 参数来完成这项工作吗?在这种情况下有没有办法禁用缓冲 - 理想情况下下载不应该失败,它应该只是禁用缓存和缓冲。

【问题讨论】:

    标签: nginx caching


    【解决方案1】:

    在 nginx 论坛中回答的问题:https://forum.nginx.org/read.php?2,285896

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-15
      • 2013-05-07
      • 1970-01-01
      • 2023-03-16
      • 2015-11-12
      • 2017-02-26
      • 1970-01-01
      • 2018-12-12
      相关资源
      最近更新 更多