Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!