Pergunta

Instalei o Varnish Turpintine em nosso site de teste seguindo as instruções no Wiki Magento-Turpintina.

Nosso site está no Ubuntu 14.04, NGINX, verniz-4.0.3m, Turpentine v0.6.5, Magento 1.9.2.

Estes são meus DAEMON_OPTS em /etc/default/varnish

DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
             -p cli_buffer=16384 \
             -p feature=+esi_ignore_other_elements \
             -p vcc_allow_inline_c=on \
             -s malloc,256m"

Instalei o módulo de terebintina com sucesso, apenas alterando realmente a configuração da chave de autenticação Secret Varnish com o \n anexado, lista negra de URL e ativação de informações de depuração.

Quando tentei salvar minha configuração, recebi o erro abaixo:

Failed to apply the VCL to 127.0.0.1:6082: Got unexpected response code from Varnish: 106 Message from VCC-compiler: directors are now in directors VMOD. ('input' Line 27 Pos 1) director default round-robin { ########---------------------- Running VCC-compiler failed, exited with 2 VCL compilation failed

Isso é o que eu tenho na geração de terebintina var/default.vcl arquivo:

vcl 4.0;
C{
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <pthread.h>
static pthread_mutex_t lrand_mutex = PTHREAD_MUTEX_INITIALIZER;
void generate_uuid(char* buf) {
pthread_mutex_lock(&lrand_mutex);
long a = lrand48();
long b = lrand48();
long c = lrand48();
long d = lrand48();
pthread_mutex_unlock(&lrand_mutex);
sprintf(buf, "frontend=%08lx%04lx%04lx%04lx%04lx%08lx",
a,
b & 0xffff,
(b & ((long)0x0fff0000) >> 16) | 0x4000,
(c & 0x0fff) | 0x8000,
(c & (long)0xffff0000) >> 16,
d
);
return;
}
}C
import std;
director default round-robin {
{
.backend = {
.host = "127.0.0.1";
.port = "8080";
.first_byte_timeout = 300s;
.between_bytes_timeout = 300s;
}
}
}
director admin round-robin {
{
.backend = {
.host = "127.0.0.1";
.port = "8080";
.first_byte_timeout = 21600s;
.between_bytes_timeout = 21600s;
}
}

Aparentemente, consegui consertar isso criando o custom_include.vcl arquivo de version-4.vcl como estava faltando

cp app/code/community/Nexcessnet/Turpentine/misc/version-4.vcl app/code/community/Nexcessnet/Turpentine/misc/custom_include.vcl

Mas agora, quando tento salvar a configuração, recebo um novo erro:

Failed to apply the VCL to 127.0.0.1:6082: Varnish data to write over length limit by 749 characters

Isto parece estar relacionado com o -p cli_buffer=16384 que eu coloquei no DAEMON_OPTS no /etc/default/varnish.Quando tento aumentar isso, ainda recebo o mesmo erro, mas com um limite diferente.

Failed to apply the VCL to 127.0.0.1:6082: Varnish data to write over length limit by 8941 characters.

não tenho nada em magento/var/log/ ou /var/log/varnish/ para verniz.Tentei verificar o Varnish Admin para ver se havia algo errado com o cli_buffer, mas não vi nada digno de nota.

$ sudo varnishadm
varnish> param.show cli_buffer
200        
cli_buffer
        Value is: 16k [bytes]
        Default is: 8k
        Minimum is: 4k

        Size of buffer for CLI command input.
        You may need to increase this if you have big VCL files and use
        the vcl.inline CLI command.
        NB: Must be specified with -p to have effect.

Agradecemos antecipadamente por quaisquer sugestões de conselhos.

Foi útil?

Solução 2

Parece que consegui fazer isso funcionar aplicando uma correção que encontrei Bilhete GitHub 915.

Primeiro, a correção que apliquei para meu primeiro erro era enganosa, então removi o arquivo que criei.

rm app/code/community/Nexcessnet/Turpentine/misc/custom_include.vcl

Então eu juntei o ramo devel do repositório Magento-Turpintine com meu projeto Magento conforme sugerido no Bilhete GitHub 915.

Agora, quando salvei a configuração do Turpintine/apliquei a configuração do Varnish, não recebi nenhuma mensagem de erro.

Embora o site não pareça ter acelerado muito, como posso garantir que o verniz esteja funcionando como deveria?

ATUALIZARConsegui garantir que o Varnish estava funcionando executando o vernizstat. Se o Hitrate avg for maior que 0, significa que o cache está sendo atingido.

Outras dicas

Obrigado por compartilhar.Acabei de instalar a versão mais recente do devel branch para corrigir um problema muito semelhante.Para verificar se o Varnish está armazenando em cache, você pode usar qualquer um dos seguintes comandos verniztop, se tiver acesso ao servidor.

/usr/bin/varnishtop -i RxURL
/usr/bin/varnishtop -i RxHeader -C -I \^HOST
Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top