Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento 马根托;清漆/松节油,零命中率_Magento_Varnish - Fatal编程技术网

Magento 马根托;清漆/松节油,零命中率

Magento 马根托;清漆/松节油,零命中率,magento,varnish,Magento,Varnish,在Ubuntu 12.04lts上运行的(nginx)、magento(1.9.0.1)、松节油和清漆(3.0.2)有一些奇怪的问题我们对清漆/松节油没有经验,所以这可能是一件基本的事情。 我们成功地将松节油vcl应用于运行的varnish实例,并使用varnishadm vcl.list检查结果。我们还在松节油中启用了调试信息 奇怪的事情: 如果我们在magento backend->cache中激活两种松节油缓存方法,尤其是fpc,我们会得到以下响应 Server nginx Transf

在Ubuntu 12.04lts上运行的(nginx)、magento(1.9.0.1)、松节油和清漆(3.0.2)有一些奇怪的问题我们对清漆/松节油没有经验,所以这可能是一件基本的事情。

我们成功地将松节油vcl应用于运行的varnish实例,并使用
varnishadm vcl.list
检查结果。我们还在松节油中启用了调试信息

奇怪的事情:

如果我们在magento backend->cache中激活两种松节油缓存方法,尤其是fpc,我们会得到以下响应

Server  nginx
Transfer-Encoding   chunked
Via 1.1 varnish
X-Frame-Options SAMEORIGIN
X-Powered-By    PHP/5.3.10-1ubuntu3.15
X-Turpentine-Cache  0
X-Turpentine-Esi    1
X-Varnish   293774805
X-Varnish-Hits  0
而且3.5秒的响应时间非常糟糕导致页面似乎从未被缓存,正如您在X-Turpentine-Cache和X-Varnish-Hits中清楚看到的那样。标题中也没有设置年龄

但如果我们停用松节油fpc,同时让vcl不被触动,我们就会

Age 29
Server  nginx
Via 1.1 varnish
X-Frame-Options SAMEORIGIN
X-Powered-By    PHP/5.3.10-1ubuntu3.15
X-Varnish   293775151 293775096
X-Varnish-Hits  2
再加上100毫秒左右的最佳响应时间,这似乎是一个成功

我们在正确设置松节油/清漆方面遗漏了什么,激活松节油缓存零命中率的原因是什么


提前感谢…

以下是一些故障排除步骤:

让清漆自己工作:

您的
varnishd
应该使用几个参数运行,以下是我的Ubuntu服务器安装的示例(
/etc/defaults/varnish
):

  • -a:6081
    公共端口--这是WebBrowser将使用的端口
  • -T localhost:6082
    管理端口——用于配置varnish
  • -f/etc/varnish/default.vcl
    初始vcl配置文件(见下文)——varnish首次启动时使用的配置
  • -s malloc,256m
    存储后端——在本例中为256MB内存后端
  • -S/etc/varnish/secret
    varnish管理员密码文件的路径
松节油还提到可能需要以下参数:

  • -p esi_语法=0x2
  • -p cli_buffer=16384
这是我的示例
default.vcl
,这是一个简单的配置,告诉Varnish代理请求127.0.0.1:80,只有在松节油重新配置Varnish:

backend default {
    .host = "127.0.0.1";
    .port = "80";
}
您可以通过检查正在运行的进程来验证这些设置是否正在使用:
ps aux|grep varnishd

测试清漆配置

varnishd使用上述参数运行时,您应该能够远程登录到您的管理端口(
-T
以上):

如果您在上面提供了
-S
,系统将提示您进行授权;使用机密文件的内容。如果无法通过telnet进入,请尝试删除
-S
参数以禁用身份验证(稍后您将希望重新启用它)。登录后,您将进入varnish控制台;把这个打开

设置松节油

我想您已经在Magento成功安装了松节油。转到
System->Configuration
,查看这些设置:

  • 清漆选项

    • 清漆版本:如果您不知道正在使用的特定版本,请设置为“自动”
    • 服务器列表:这应该与上例中
      varnishd
      -
      localhost:6082
      -T
      参数完全匹配
    • Varnish身份验证密钥:这应该是用于上述
      -S
      的密钥,如果禁用了身份验证,则为空
  • 缓存选项

    • 后端主机:
      localhost
      如果Magento和Varnish在同一台服务器上,则为Magento主机
    • 后端端口:Magento的HTTP端口(通常为80)
保存这些配置时,您应该会看到一条成功或错误消息。此消息表示松节油能够生成新的VCL配置文件,并使其在Varnish中处于活动状态。要确认这一点,请使用telnet会话运行
vcl.list
。您应该看到如下内容:

vcl.list
200 106     
available       4 boot
active          2 ef1a15f2132a599ed26520c94c599e71aa7f5e576afcfca211e6249dcd640ddd
boot
是上面的
默认值;第二个VCL是松节油产生的,并已切换为激活状态

  • 使用
    System->Cache Management
    启用两个Varnish Magento缓存;刷新所有缓存并注销管理面板,以确保一切生效
此时,松节油应开始运转。您可以运行
varnishstats
并使用
-a
端口从
varnishd
加载网页。多次重新加载页面会导致命中率高于零


请记住,使用此配置,如果重新启动
varnishd
(以及缓存内容),松节油VCL将丢失。您可以使用magento的
缓存管理
页面导出一个新的.acl文件以用于
-f
参数,以便它在varnish重新启动时生效。

是否启用了magento中的所有缓存?是的,所有内部缓存。我禁用了memcached等。当然,没有其他外部fullpagecache运行…“服务器nginx”在这两个标题中使我认为您的配置有问题。我看不到全貌,所以这个问题只是猜测。你救了我的命,你却不知道。我的问题是服务器列表显示127.0.0.1:6082和-T localhost:6082。谢谢你
vcl.list
200 106     
available       4 boot
active          2 ef1a15f2132a599ed26520c94c599e71aa7f5e576afcfca211e6249dcd640ddd