Varnish - HTTP Accelerator Crash Course
Hussein Nasser
0:00 / 0:00
Varnish - HTTP Accelerator Crash Course
40 212 просмотров · 6 лет назад
Hussein Nasser
518 тыс. подписчиков
40 212 просмотров · 6 лет назад
Varnish is a reverse proxy web accelerator Written in C designed to improve HTTP performance by using server side caching.
In this video I’m going to go through how Varnish works, we will spin up a Varnish docker container and finally talk about the pros and cons of this tech.
Chapters
0:00 Intro
1:53 Classic HTTP Architecture
3:50 How Varnish Works
7:50 Demo HTTP
18:23 Demo HTTPS
28:43 Varnish Pros
39:26 Varnish Cons
Agenda
Classic HTTP Architecture
How Varnish Works?
HTTP Setup - Varnish
HTTPS Setup - Varnish with Caddy as TLS Terminator.
Varnish Pros & Cons
Summary
Pros
Cache & prefetching documents
Resolve DNS hostnames in documents
Rewrite scripts to optimize code
Load Balancing
Backend Connection Pooling
Varnish Modules (VMODS, e.g. rewrite headers)
Edge side includes (personalized dynamic page)
Cons
Cache Invalidation
Only works on unencrypted HTTP
For HTTPS frontend, terminate TLS
For HTTPS backend, no solution in Varnish open source
Can’t cache POST requests (e.g. GraphQL queries)
HTTP/2 backends won’t benefit
docker commands
docker run --name varnish -p 8080:80 varnish
docker cp default.vcl varnish:/etc/varnish
default.vcl
vcl 4.0;
backend default {
.host = "husseinmac";
.port = "2015";
}
Cards:
Connection Pooling 2:15 • Connection Pooling in PostgresSQL with Nod...
Layer 4 vs Layer 7 Load balancing 6:25 • Load balancing in Layer 4 vs Layer 7 with ...
GET vs POST 6:48 • When to use HTTP GET vs POST?
Postgres NodeJS Chrome 8:23 • Building a Web API with Express and Postgr...
Redis 46:13 • Redis In-memory Database Crash Course
TLS Termination 49:35 • SSL/TLS Termination, TLS Forward Proxy Pro...
Resources
edge side includes
https://www.fastly.com/blog/using-esi...
Cache invalidation varnish
https://www.smashingmagazine.com/2014...
Varnish Doc
https://varnish-cache.org/docs/
🏭 Software Architecture Videos
• Software Architecture
💾 Database Engineering Videos
• Database Engineering
🛰 Network Engineering Videos
• Network Engineering
🏰 Load Balancing and Proxies Videos
• Proxies
🐘 Postgres Videos
• PostgresSQL
🧮 Programming Pattern Videos
• Programming Patterns
🛡 Web Security Videos
• Web Security
🦠 HTTP Videos
• HTTP
🐍 Python Videos
• Python by Example
🔆 Javascript Videos
• Javascript by Example
Support me on PayPal
https://bit.ly/33ENps4
Become a Patreon
/ hnasr
Stay Awesome,
Hussein