光油缓存 - 网页的初始高速缓存 [英] Varnish Cache - Initial cache of web pages

查看:220
本文介绍了光油缓存 - 网页的初始高速缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了光油缓存与我的Apache Web服务器并正确配置。它的工作原理确定,现在我可以访问我的网页虽然光油缓存。

I have installed the Varnish cache with my Apache web server and configured them correctly. It works OK and I can now access my web pages though Varnish Cache.

清漆的默认行为是存储由Web服务器提供的网页的副本。请求相同的网页,在下一次光油将服务副本,而不是从Apache服务器请求的页面。

The default behavior of varnish is to store copies of the pages served by the web server. The next time the same page is requested, Varnish will serve the copy instead of requesting the page from the Apache server.

而现在我的问题是:是否有可能最初缓存我整个网站设置了缓存光油后,没有必要非得进行访问,然后将其存储在缓存中的网页?这是因为,后清漆已设置,则高速缓存最初是空的,而这将需要以可用的高速缓存将被访问的页面。可以这样无需手动访问的每个页面做了什么?

And now comes my question: Is it possible to cache my entire website initially after setting up the Varnish cache, without the need to have a page to be accessed then store it on the cache? This is because, after varnish has been setup, the cache is initially empty, and it will require a page to be accessed in order to be available on the cache. Can this be done without having to access each page manually?

推荐答案

你所寻找的是热身缓存的方式。你可以使用 varnishreplay 网络爬虫,如WGET或的HTTrack去通过您的网站。另外,如果你有你的网页的网站地图你可以使用它作为一个出发点,通过循环热身缓存它并且使用如网页发出请求卷曲或wget的。

What you are looking for is a way of warming up the cache. You could use varnishreplay or a Web crawler, such as Wget or HTTrack to go through your site. Alternatively if you have a sitemap of your pages you could use that as a starting point and warm up the cache by looping over it and issuing requests on the pages using e.g. curl or wget.

使用varnishreplay需要先运行varnishlog并收集日志流量之前,你以后可以用它播放的交通和热身缓存。

Using varnishreplay requires you to first run varnishlog and gather a log of traffic before you can use it later for playing back the traffic and warming up the cache.

Wget的,等的HTTrack可以指出您的主页,他们将通过您的网站抓取他们的方式。根据您的网站的规模和性质,这可能不是实际的,虽然(例如,如果您使用Ajax广泛)。

Wget, HTTrack etc. can be pointed to your home page and they will crawl their way through your site. Depending on the size and nature of your site this might not be practical though (for example if you use Ajax extensively).

除非你的网页需要很长的时间,从后端服务器(即Apache)的加载,我不会太担心升温缓存。如果缓存的内容的TTL足够高的大部分参观者将只接收缓存的内容呢。

Unless your pages take a very long time to load from the backend server (i.e. Apache), I wouldn't worry too much about warming up the cache. If the TTL for the cached content is high enough most of the visitors will only ever receive cached content anyway.

这篇关于光油缓存 - 网页的初始高速缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆