缓存大量数据

缓存大量数据

我们需要缓存来自 amazone S3 存储的所有 psd/zip 文件。缓存量在 150-200 Gb 之间(我们需要存储文件至少 2 个月)。现在我们使用透明代理 squid,没有任何缓存。

所以我的问题是:是否可以这样配置“主”squid,以便所有对 s3.amazonaws.com 的查询都将代理到父 squid。在父 squid 中,我们需要仅缓存来自 s3.amazonaws.com 的所有 zip 和 psd 文件。如果缓存中没有此类文件,父 squid 将下载并将“新”文件放入缓存中。

squid 如何处理 1-2 GB 的文件?有什么限制吗?

这种设置的主要证明是,来自亚马逊存储的所有 psd/zip 文件都以最大速度从本地缓存传送到本地客户端。因为不同的员工同时使用相同的文件,我们花了很多时间让每个员工下载这些文件

这个问题能用不同的方法解决吗?

答案1

我们已经测试了我们的系统大约一个月并且它运行良好。如果有人感兴趣,下面我添加了配置文件(主/父 squid)

主 squid(192.168.100.1)配置文件

acl local_net src 192.168.0.0/16
acl parent_peer peername PARENT_PEER
acl parent_squid dst 192.168.100.50

acl FILE_TO_CACHE urlpath_regex \.(zip|iso|rar)$
acl STORAGE dstdomain storage.example.net

http_port 192.168.100.1:3128 intercept
icp_port 3130

cache_peer 192.168.100.50 parent 3128 3130 name=PARENT_PEER connect-timeout=7 proxy-only
cache_peer_access PARENT_PEER allow STORAGE FILE_TO_CACHE

# to connect to parent via internal interface
tcp_outgoing_address 192.168.100.1 parent_peer

# to properly get cache digest from parent
tcp_outgoing_address 192.168.100.1 parent_squid

# sent all other packets via ISP2
tcp_outgoing_address xxx.xxx.xxx.xxx local_net

父 squid(192.168.100.50)配置文件

acl main_squid src 192.168.100.1

acl FILE_TO_CACHE urlpath_regex -i \.(zip|iso|rar)$

cache allow FILE_TO_CACHE
cache deny all

http_access allow main_squid
http_access allow localhost
http_access deny all

icp_port 3130
icp_access allow main_squid
icp_access deny all

http_port 192.168.100.50:3128

cache_mem 12 GB
maximum_object_size_in_memory 64 MB
minimum_object_size 16384 KB
maximum_object_size 1024 MB

cache_swap_low 93
cache_swap_high 98

refresh_pattern \.iso$ 129600 100 129600 override-lastmod override-expire ignore-reload
refresh_pattern \.zip$ 129600 100 129600 override-lastmod override-expire ignore-reload
refresh_pattern \.rar$ 129600 100 129600 override-lastmod override-expire ignore-reload

cache_effective_user squid
cache_effective_group squid

相关内容