Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda