Varnish by Aswin

307 views
221 views

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
307
On SlideShare
0
From Embeds
0
Number of Embeds
27
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Varnish by Aswin

  1. 1. @agatestudio Varnish Aswin Knight Agate Studio
  2. 2. @agatestudio@agatestudio@agatestudio VARNISH Aswin Juari
  3. 3. @agatestudio@agatestudio@agatestudio Overview • What is varnish • Why Varnish • What to do
  4. 4. @agatestudio@agatestudio@agatestudio What • A Proxy • A Load balancer • An Http Accelerator which accelerates by caching output from apache/another web server.
  5. 5. @agatestudio@agatestudio@agatestudio Why • So, instead of web server doing the same process and the same result, why not caching the result and pass to user. • However, remember that: – Your data might be obsolete/incorrect – So, you must configure varnish correctly. • Determine which one that can be processed by varnish • Or the one that must be checked by Web Server
  6. 6. @agatestudio@agatestudio@agatestudio What to do • Configure Varnish at port 80, Apache at another port (e.g. 8080) vcl 4.0; backend default { .host = "127.0.0.1"; .port = "8080"; }
  7. 7. @agatestudio@agatestudio@agatestudio What to do • Request Scheme Varnish: Request Received  vcl_recv()  vcl_pass()  vcl_fetch()  vcl_deliver()  Request Completed
  8. 8. @agatestudio@agatestudio@agatestudio What to do Pass: Send it to apache Lookup: try to get it from cache sub vcl_recv { # Set the URI of your system directory if (req.url ~ '^/admin/' || req.url ~ 'ACT=' || req.request == 'POST') { return (pass); } #unset user cookie from being saved to cache unset req.http.Cookie; return(lookup); }
  9. 9. @agatestudio@agatestudio@agatestudio What to do sub vcl_fetch { # Our cache TTL set beresp.ttl = 1m; return(deliver); } Set Cache not older than 1 minute
  10. 10. @agatestudio@agatestudio@agatestudio Varnish vs NginX • Varnish cannot do https request :D. Meanwhile nginx can do that. • Others said that better we use nginx only :D – Config varnish, nginx, apache is not worth of time – Nginx + PHP + DB + APC/Memcache is more than enough – So, it depends on App in the Server
  11. 11. @agatestudio@agatestudio@agatestudio Sources • https://www.varnish- cache.org/docs/4.0/tutorial/index.html • http://ellislab.com/blog/entry/making-sites-fly-with- varnish • https://www.varnish- software.com/system/files/web_downloads/varnish- book.pdf

×