Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

149
Visualizações
Angular ssr varnish usage

It working but not affect performance. Do I use it right?

/etc/varnish/default.vcl

    backend default { 
    .host = "127.0.0.1"; 
    .port = "4000"; }

i was add vanish port instead 4000 in nginx config

 location / {
      proxy_pass          http://localhost:6081;
}

My Angular application (google pagespeed) desktop performance is 99% but the mobile performance is 40-60%.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Varnish's out-of-the-box behavior respects HTTP caching best practices.

This means:

  • Only cache HTTP GET & HTTP HEAD calls
  • Don't serve responses from cache when the request contains cookie headers
  • Don't serve responses from cache when the request contains authorization headers
  • Don't store responses in cache when set-cookie headers are present
  • Don't store responses in cache when the cache-control header is a zero TTL or when it contains the following: no-cache, or no-store, or private

Under all circumstances Varnish will try to serve from cache or store in cache.

This is that behavior written in VCL: https://github.com/varnishcache/varnish-cache/blob/6.0/bin/varnishd/builtin.vcl

Adapting to the real world

Although these caching best practices make sense, they are not realistic when you look at the real world. In the real world we use cookies all the time.

That's why you'll probably have to write some VCL code to change the behavior of the cache. In order to do so, you have to be quite familiar with the HTTP endpoints of your app, but also the parts where cookies are used.

  • Parts of your app where cookie values are used on the server-side will have to be excluded from caching
  • Parts of your app where cookie values aren't used will be stored in cache
  • Tracking cookies that are only used at the client side will have to be stripped

How to examine what's going on

The varnishlog binary will help you understand the kind of traffic that is going through Varnish and how Varnish behaves with that traffic.

I've written an in-depth blog post about this, please have a look: https://feryn.eu/blog/varnishlog-measure-varnish-cache-performance/

Writing VCL

Once you've figured out what is causing the drop in performance, you can write VCL to mitigate. Please have a look at the docs site to learn about VCL: https://varnish-cache.org/docs/6.0/index.html

The is reference material in there, a user guide and even a tutorial.

Good luck

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda