标签: cache

Nginx 缓存非托管增长

我们有两个具有独立本地缓存的 Nginx 服务器,用于缓存图像。缓存大小的非托管增长会定期出现问题。此大小可能远远大于max_sizenginx.conf。结果缓存占用了所有可用磁盘空间。

我想了解这个问题的原因可能是什么。

代理缓存配置 ( nginx.conf):

proxy_cache_path /opt2/nginx-cache-images1 max_size=150g levels=2:2 keys_zone=images1:1024m inactive=24h;
proxy_temp_path /opt2/proxy_temp 1 2;
Run Code Online (Sandbox Code Playgroud)

大小/opt2/nginx-cache-images1约为 200GB。

站点位置配置:

location / {
   proxy_set_header Host $host;
   proxy_set_header X-Forwarded-For $remote_addr;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Is-Referer-Search-Engine $is_referer_search_engine;
   proxy_hide_header Set-Cookie;
   proxy_hide_header Content-Disposition;
   proxy_pass http://ua-image-proxy;
   default_type image/jpeg;

   proxy_cache images1;
   proxy_cache_key ua$request_uri$is_referer_search_engine;
   proxy_cache_valid 200 24h;
   proxy_cache_valid 301 24h;
   proxy_cache_valid 404 1h;
}
Run Code Online (Sandbox Code Playgroud)

Nginx 版本:1.7.7 和 1.7.9。它是在 Ubuntu 14.04 上编译的。

nginx cache

6
推荐指数
1
解决办法
1047
查看次数

FastCGI缓存总是一个MISS

所以,我已经像这样设置了 FastCGI 缓存:

location ~ \.php(/.*)?$ {
    fastcgi_cache RWI;
    fastcgi_cache_valid 200 60m;

    set $nocache 0;
    if ($request_method = POST)
    {
        set $nocache 1;
    }

    if ($http_cookie ~ (rwi_userid*|rwi_password*)) {
        set $nocache 1;
    }

    if ($request_uri ~* "/(vb/admincp/)") {
        set $nocache 1;
    }

    fastcgi_no_cache $nocache;
    fastcgi_cache_bypass $nocache;

    fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_pass "unix:/var/www/vhosts/system/{domain}/php-fpm.sock";
    include /etc/nginx/fastcgi.conf;
}
Run Code Online (Sandbox Code Playgroud)

server{}块的顶部,我有:

fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=RWI:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
add_header X-Cache $upstream_cache_status;
Run Code Online (Sandbox Code Playgroud)

问题是我的 PHP 脚本 (vBulletin) 总是发送 Pragma & Cache-Control private。当上述规则不适用时,有没有办法忽略这些标头并强制 FastCGI …

nginx cache fastcgi php-fpm

6
推荐指数
1
解决办法
8108
查看次数

OpenLDAP 代理缓存不检索条目

我需要设置一个连接到我们中央 Active Directory 服务器的本地 LDAP 代理缓存。OpenLDAP 代理缓存看起来很像。但是尽可能地遵循联机帮助页,我无法使其正常工作。

我能够通过 localhost 将请求代理到远程服务器,但它们没有被缓存(或者至少没有检索到缓存)。

我做的步骤:

  • 安装openldap-serversopenldap-clients打包
  • 创建了一个slapd.conf配置文件(详细信息如下)
  • 为代理数据库创建一个目录并将默认的 DB_CONFIG 文件复制到那里(详细信息如下)
  • Ranslapd -d -1命令启动服务器
  • 使用以下命令查询服务器: ldapwhoami -vvv -h localhost -D "CN=Melka Martin,OU=(...),DC=int,DC=ourdomain,DC=com" -x -w <password>

结果是成功。但是嗅探网络流量显示查询是从中央 LDAP 服务器汇集的。

slapd输出是非常详细,但它确实在一个点状态

QUERY NOT ANSWERABLE
QUERY CACHEABLE
Run Code Online (Sandbox Code Playgroud)

唉,如果它确实被缓存了,它永远不会被回答。任何想法可能是错误的?

"cn=admin,dc=int,dc=ourdomain,dc=com"是远程 LDAP 服务器中管理员用户的 DN。<something>是他的密码。

配置文件

database        ldap
suffix          "dc=int,dc=ourdomain,dc=com"
rootdn          "cn=admin,dc=int,dc=ourdomain,dc=com"
rootpw          <something>
uri             ldap://dc-04.int.ourdomain.com:389

overlay pcache
pcache         hdb 100000 1 1000 100
pcacheAttrset  0 …
Run Code Online (Sandbox Code Playgroud)

openldap proxy cache

6
推荐指数
1
解决办法
1886
查看次数

在客户端网络上现场缓存视频内容的同时控制访问

我们有很多小时的视频培训课程,我们希望通过加密或控制访问的方式向客户现场提供这些课程

目前,我们通过网站(例如 udacity)提供,但由于互联网带宽,一些大公司希望在现场提供。我们不想只给他们一个带有 mp4 文件的硬盘,但我们也不需要军用级加密(因为最后,他们可以用摄像机录制)

我想我们可以为他们提供一个带有视频的媒体服务器,让我们的本地网络应用程序在他们的网络上运行,并与我们的(网络)服务器通信以跟踪/获取令牌,并与本地媒体服务器通信以获取视频。

有人告诉我“其他供应商正在提供这个”,但我不知道“如何”。我猜他们使用 Adob​​e Media Server 或其他东西。

如何在客户端“本地缓存”现场视频,但仍然可以控制对视频的访问?

security cache video-hosting video-streaming

6
推荐指数
1
解决办法
78
查看次数

现在主要服务已经迁移到https,缓存代理服务器是否仍然有助于节省带宽?

我住在土耳其,是一个计划建立基于 WiFi 的 ISP 来为我的家乡服务的小组的成员,因为我们相信以无线方式连接所有离我们市中心不近的子村庄会更容易。在我们研究该项目所需设备的过程中,我们已经阅读了缓存代理服务器,该服务器存储来自经常访问的网站的数据,以便可以从缓存代理服务器下载内容,而不是通过我们的回程传输到互联网并消费那个带宽。

我们预计我们的用户将大量贩卖流行的社交网站,如 Facebook 和 Twitter,以及数据和视频内容农场、网上银行网站和许多其他使用https. 从我读过的关于这个主题的所有信息来看,我们将无法缓存这些内容,所以我觉得也许我们应该放弃使用缓存代理服务器的搜索。

在我们的例子中,考虑到我们预计大部分流量都会结束,考虑使用缓存代理服务器是否有意义https?使用这项技术,我们能否在回程中节省大量带宽?

wifi proxy https cache isp

6
推荐指数
1
解决办法
275
查看次数

如何调整 Windows Server 2012 R2 以处理包含 5000 万个文件的 NTFS 文件结构?

我有一个开发人员实用程序,我将用它来生成 5000 万个文件。目录结构有四层深。顶层包含 16 个目录(2000-2016 年),下一层 - 月(1-12),下一层 - 天(1 - 31),最后是 - xml 文件(每个最多 85k)。最终目录可能有 3000 多个文件(我还没有算出 5000 万个文件如何适合该目录结构)。

我目前正在运行该实用程序,并且我已经完成了大约 1/3(要执行的天数)。正如我所担心的,遍历目录树的任何部分都是一种痛苦的经历。仅在资源管理器中需要几秒钟。这与服务器级硬件。SAS 7200RPM(我知道现在这并不快)12 TB Raid 5 或 10,分配有 4 个 3.4ghz xeon cpu。

如何提高 Windows Server 2012 R2 在内存中缓存文件句柄的能力?我没有运行 NFS 服务。


M:\>defrag /a /v /h m:
Microsoft Drive Optimizer
Copyright (c) 2013 Microsoft Corp.

Invoking slab consolidation on DB MDF (M:)...


The operation completed successfully.

Post Defragmentation Report:

    Volume Information:
            Volume size                 = 12.99 TB
            Cluster size                = 64 KB …
Run Code Online (Sandbox Code Playgroud)

ntfs cache vmware-vsphere windows-server-2012-r2

6
推荐指数
1
解决办法
4594
查看次数

使用缓存文件 mtime 作为 Last-Modified 标头值

在 nginx 1.10.1 上,我代理一个外部网站(不受我控制)在本地缓存图像。

我的配置如下:

location ~ /cachedimages/(?<productcode>.*)/(?<size>.*)/image.jpg {
   resolver 127.0.0.1;
   proxy_pass             https://www.externalsite.example/api/getImage/?productcode=$productcode&size=$size;
   proxy_cache            imgcache;
   proxy_cache_valid      200  1d;
   proxy_cache_use_stale  error timeout invalid_header updating http_500 http_502 http_503 http_504;

   expires 1M;
   access_log off;
   add_header 'Cache-Control' "public";
   add_header Last-Modified $upstream_http_last_modified;
   add_header X-Proxy-Cache $upstream_cache_status;
  }
Run Code Online (Sandbox Code Playgroud)

imgcache 定义如下:

proxy_cache_path /var/cache/nginx/imgcache levels=1:2 keys_zone=imgcache:10m max_size=1g inactive=24h;
Run Code Online (Sandbox Code Playgroud)

远程服务器不提供Last-Modified标题:

curl -X GET -I https://www.externalsite.example/api/getImage/?productcode=abc123&size=128
HTTP/1.1 200 OK
Date: Thu, 15 Sep 2016 08:16:07 GMT
Server: Apache
Transfer-Encoding: chunked
Content-Type: image/jpeg
Run Code Online (Sandbox Code Playgroud)

我的服务器添加了一些标题但没有 Last-Modified

curl -X GET -I https://www.myserver.com/cachedimages/abc123/128/image.jpg …
Run Code Online (Sandbox Code Playgroud)

nginx cache

6
推荐指数
1
解决办法
2328
查看次数

重复的 max-age 标头

我正在使用 Apache 2.4.25 通过代理传递公开许多后端服务。Apache 还根据 mime 类型设置缓存控制标头。当前缓存配置如下所示:

ExpiresActive on
ExpiresDefault "now"
ExpiresByType text/html "now"
ExpiresByType image/gif "access plus 120 minutes"
ExpiresByType image/jpeg "access plus 120 minutes"
ExpiresByType image/png "access plus 120 minutes"
ExpiresByType text/css "access plus 60 minutes"
ExpiresByType text/javascript "access plus 60 minutes"
ExpiresByType application/x-javascript "access plus 60 minutes"
ExpiresByType text/xml "access plus 60 minutes"
ExpiresByType application/javascript "access plus 60 minutes"
ExpiresByType application/x-font-ttf "access plus 30 days"
ExpiresByType application/x-font-woff "access plus 30 days"
ExpiresByType application/x-font-eot "access plus 30 days" …
Run Code Online (Sandbox Code Playgroud)

proxy cache proxypass apache-2.4

6
推荐指数
1
解决办法
1427
查看次数

禁用 HDD 写入缓存时性能更好?(HGST Ultrastar 7K6000 和媒体缓存行为)

请注意。长读。
在我计划在我的 Ceph 设置中使用的 Hitachi Ultrastar 7K6000 驱动器的初始性能测试期间,我注意到一个奇怪的事情:禁用磁盘写入缓存时写入性能更好。


我使用fio

fio --filename=/dev/sda --direct=1 --sync=1 --rw=randwrite --bs=4k --numjobs=1 --iodepth=1 --runtime=60 --time_based --group_reporting --name=4krandw
Run Code Online (Sandbox Code Playgroud)

当写缓存被禁用时:

hdparm -W 0 /dev/sda 

4krandw: (groupid=0, jobs=1): err= 0: pid=6368: Thu Jun 22 07:36:44 2017
write: io=63548KB, bw=1059.9KB/s, iops=264, runt= 60003msec
clat (usec): min=473, max=101906, avg=3768.57, stdev=11923.0
Run Code Online (Sandbox Code Playgroud)

启用写缓存时:

hdparm -W 1 /dev/sda

4krandw: (groupid=0, jobs=1): err= 0: pid=6396: Thu Jun 22 07:39:14 2017
write: io=23264KB, bw=397005B/s, iops=96, runt= 60005msec
clat (msec): min=1, max=48, avg=10.30, stdev= 4.12 …
Run Code Online (Sandbox Code Playgroud)

performance storage cache iops ceph

6
推荐指数
1
解决办法
3411
查看次数

Microsoft Storage Spaces 回写缓存存在于仅 HDD 的单层奇偶校验磁盘上吗?

我在连接到 Windows 10 1809 机器的 3x 外部 USB 4tb HDD 上创建了一个奇偶校验存储空间。然后我将这些 HDD 移到 Server 2019 1809 机器上,并添加了 1 个额外的 4tb HDD。

我注意到在这个只有 HDD 的单层奇偶校验存储空间中有一个现有的 32mb 写回缓存。

有没有办法确定它的位置或它为什么存在?我不确定它是否存在于 W10 机器上,从未检查过,但想象一下它一定存在。只在 Server 2019 机器上注意到它,因为 Server Manager 将它显示在 Storage Pools 信息中。

存储空间是否尝试将主机设备 SSD/RAM 用于 WBC,即使它们不是池的一部分?为什么?W10 和 Server 2019 机器都有 SSD 主机操作系统驱动器。

在此处输入图片说明

storage cache windows-server-2019 write-back

6
推荐指数
1
解决办法
544
查看次数