This document contains the slides from a presentation on Varnish given by Mike Willbanks at the Northeast PHP conference on August 12, 2012. The presentation covered an introduction to Varnish including what it is, how it works, and its benefits. It discussed installing and configuring Varnish using VCL files and introduced concepts like directors, variables, and functions in VCL. Examples were provided of using Varnish for WordPress caching. The presentation aimed to explain both basic and advanced uses of Varnish.
In this talk, we'll cover all the great built-in rails caching options and best practices for getting the most out of these. Then we'll talk about dynamic content, why it's traditionally not cached, and how you can can cache it using this thing called "edge caching".
Welcome to the future, where you can cache the uncacheable.
Memcached: What is it and what does it do?Brian Moon
Memcached has become the de facto standard for caching web applications. But, many users jump in feet first without understanding what it does or perhaps more importantly what it does not do. Once you understand memcached, you may come to realize that it is what it does not do that makes it so good.
Memcached is a distributed memory based caching system. But, what does that mean for you? This session will cover the basics of memcached. What are all the components needed? Where is your data cached? What happens when there is a system failure? Is my data stored in more than one place? How do I know what is in my cache? All these questions and more will be answered.
Memcached: What is it and what does it do? (PHP Version)Brian Moon
Memcached has become the de facto standard for caching web applications. But, many users jump in feet first without understanding what it does or perhaps more importantly what it does not do. Once you understand memcached, you may come to realize that it is what it does not do that makes it so good. Memcached is a distributed memory based caching system. But, what does that mean for you? This session willcover the basics of memcached. What are all the components needed? Where is your data cached? What happens when there is a system failure? Is my data stored in more than one place? How do I know what isin my cache? All these questions and more will be answered.
Presentation Video: http://youtu.be/hZQc335WIvc
Goals:
Thorough understanding of Varnish.
Understanding of how VCL works and how to use it.
Know how varnish works with Drupal and Wordpress.
Debug using varnish tools.
Caching has been an essential strategy for greater performance in computing since the beginning of the field. Nearly all applications have data access patterns that make caching an attractive technique, but caching also has hidden trade-offs related to concurrency, memory usage, and latency.
As we build larger distributed systems, caching continues to be a critical technique for building scalable, high-throughput, low-latency applications. Large systems tend to magnify the caching trade-offs and have created new approaches to distributed caching. There are unique challenges in testing systems like these as well.
Ehcache and Terracotta provide a unique way to start with simple caching for a small system and grow that system over time with a consistent API while maintaining low-latency, high-throughput caching.
CouchDB for Web Applications - Erlang Factory London 2009Jason Davies
CouchDB is built "of the Web" and it's very exciting to convert the immense
power that CouchDB provides into a usable, real-world Web application. In this
talk I cover case studies of real-world applications that use CouchDB,
including some that can be served from CouchDB itself, and how CouchDB can
shape your Web applications to be highly scalable and flexible by embracing
HTTP philosophies, JavaScript and schemaless documents.
EWD 3 Training Course Part 34: QEWD Resilient ModeRob Tweed
This is part 34 of the EWD 3 Training Course. This presentation explains how you can add resilience to the message queue used by QEWD by making it save all incoming requests to your embedded Global Storage database. In Resilient Mode, QEWD also saves a copy of all responses sent to clients, so the stored activity information can be used as an audit trail.
Integrating multiple CDN providers at Etsy - Velocity Europe (London) 2013Marcus Barczak
Relying on a single content delivery network for your site can impose a number of flexibility limitations. By diversifying your CDN providers you can put the power back in your hands, allowing you to get the best of both worlds in terms of performance, reliability and cost. In this talk Marcus and Laurie will present Etsy’s recent work integrating multiple CDN providers to their site delivery infrastructure.
This presentation was delivered at Velocity Europe, November 2013
Build your own CDN with Varnish - Confoo 2022Thijs Feryn
Slides for my Confoo 2022 presentation on how to create your own Content Delivery Network using Varnish.
See https://feryn.eu/speaking/build-cdn-varnish-confoo22/ for more information
www.caucho.com
Using industry standard tool and methodology, Resin Pro web server was put to the test versus Nginx, a popular web server with a reputation for efficiency and performance. Nginx is known to be faster and more reliable under load than the popular Apache HTTPD. Benchmark tests between Resin and Nginx yielded competitive figures, with Resin leading with fewer errors and faster response times. In numerous and varying tests, Resin handled 20% to 25% more load while still outperforming Nginx. In particular, Resin was able to sustain fast response times under extremely heavy load while Nginx performance degraded.
EWD 3 Training Course Part 1: How Node.js Integrates With Global Storage Data...Rob Tweed
This presentation is the first part of the EWD 3 Training Course. It provides an overview of how Node.js integrates with Global Storage Databases such as InterSystems' Cache, GT.M and the Redis-based ewd-redis-globals
In this talk, we'll cover all the great built-in rails caching options and best practices for getting the most out of these. Then we'll talk about dynamic content, why it's traditionally not cached, and how you can can cache it using this thing called "edge caching".
Welcome to the future, where you can cache the uncacheable.
Memcached: What is it and what does it do?Brian Moon
Memcached has become the de facto standard for caching web applications. But, many users jump in feet first without understanding what it does or perhaps more importantly what it does not do. Once you understand memcached, you may come to realize that it is what it does not do that makes it so good.
Memcached is a distributed memory based caching system. But, what does that mean for you? This session will cover the basics of memcached. What are all the components needed? Where is your data cached? What happens when there is a system failure? Is my data stored in more than one place? How do I know what is in my cache? All these questions and more will be answered.
Memcached: What is it and what does it do? (PHP Version)Brian Moon
Memcached has become the de facto standard for caching web applications. But, many users jump in feet first without understanding what it does or perhaps more importantly what it does not do. Once you understand memcached, you may come to realize that it is what it does not do that makes it so good. Memcached is a distributed memory based caching system. But, what does that mean for you? This session willcover the basics of memcached. What are all the components needed? Where is your data cached? What happens when there is a system failure? Is my data stored in more than one place? How do I know what isin my cache? All these questions and more will be answered.
Presentation Video: http://youtu.be/hZQc335WIvc
Goals:
Thorough understanding of Varnish.
Understanding of how VCL works and how to use it.
Know how varnish works with Drupal and Wordpress.
Debug using varnish tools.
Caching has been an essential strategy for greater performance in computing since the beginning of the field. Nearly all applications have data access patterns that make caching an attractive technique, but caching also has hidden trade-offs related to concurrency, memory usage, and latency.
As we build larger distributed systems, caching continues to be a critical technique for building scalable, high-throughput, low-latency applications. Large systems tend to magnify the caching trade-offs and have created new approaches to distributed caching. There are unique challenges in testing systems like these as well.
Ehcache and Terracotta provide a unique way to start with simple caching for a small system and grow that system over time with a consistent API while maintaining low-latency, high-throughput caching.
CouchDB for Web Applications - Erlang Factory London 2009Jason Davies
CouchDB is built "of the Web" and it's very exciting to convert the immense
power that CouchDB provides into a usable, real-world Web application. In this
talk I cover case studies of real-world applications that use CouchDB,
including some that can be served from CouchDB itself, and how CouchDB can
shape your Web applications to be highly scalable and flexible by embracing
HTTP philosophies, JavaScript and schemaless documents.
EWD 3 Training Course Part 34: QEWD Resilient ModeRob Tweed
This is part 34 of the EWD 3 Training Course. This presentation explains how you can add resilience to the message queue used by QEWD by making it save all incoming requests to your embedded Global Storage database. In Resilient Mode, QEWD also saves a copy of all responses sent to clients, so the stored activity information can be used as an audit trail.
Integrating multiple CDN providers at Etsy - Velocity Europe (London) 2013Marcus Barczak
Relying on a single content delivery network for your site can impose a number of flexibility limitations. By diversifying your CDN providers you can put the power back in your hands, allowing you to get the best of both worlds in terms of performance, reliability and cost. In this talk Marcus and Laurie will present Etsy’s recent work integrating multiple CDN providers to their site delivery infrastructure.
This presentation was delivered at Velocity Europe, November 2013
Build your own CDN with Varnish - Confoo 2022Thijs Feryn
Slides for my Confoo 2022 presentation on how to create your own Content Delivery Network using Varnish.
See https://feryn.eu/speaking/build-cdn-varnish-confoo22/ for more information
www.caucho.com
Using industry standard tool and methodology, Resin Pro web server was put to the test versus Nginx, a popular web server with a reputation for efficiency and performance. Nginx is known to be faster and more reliable under load than the popular Apache HTTPD. Benchmark tests between Resin and Nginx yielded competitive figures, with Resin leading with fewer errors and faster response times. In numerous and varying tests, Resin handled 20% to 25% more load while still outperforming Nginx. In particular, Resin was able to sustain fast response times under extremely heavy load while Nginx performance degraded.
EWD 3 Training Course Part 1: How Node.js Integrates With Global Storage Data...Rob Tweed
This presentation is the first part of the EWD 3 Training Course. It provides an overview of how Node.js integrates with Global Storage Databases such as InterSystems' Cache, GT.M and the Redis-based ewd-redis-globals
Book V helps you find ways to overcome procrastination and other forms of writer's block by teaching you to honor your natural approach to writing and editing so you can produce high-quality material and complete your applications in advance of your deadlines.
Book IV helps you to find ways of describing your research experience and interests that demonstrate your commitment to empirically-based treatment approaches, even if you are primarily training to become a clinical psychologist.
How Flipping your Classroom Can Improve InstructionElizabeth Nesius
Flipping a classroom is a type of blended learning that allows instructors more time to interact with their students by placing traditional classroom activity, such as lectures, outside of class time. Watching lectures in class leaves class time for hands-on activities, small group work, and one-on-one interactions between professor and student. Flipping can be done through LMS forums, Khan Academy, lecture capture software, VoiceThread, etc. This presentation will discuss benefits of the flipped classroom model, provide ideas and best practices for successful classroom flipping, and give participants an opportunity to start planning how to flip their own classes.
Talk given at ClueCon 2016 that discusses FreeSWITCH and its place in a microservices architecture. Covers a specific deployment case using Docker and Adhearsion, along with certain features that make FreeSWITCH a model use-case for such a technology stack.
BDTC2015 hulu-梁宇明-voidbox - docker on yarnJerry Wen
From http://www.csdn.net/article/2015-12-17/2826501
《Hulu 资深研发主管梁宇明 :Voidbox - Docker On YARN在Hulu的实践》
Docker 技术越来越得到了很多开发者的青睐,而YARN对于多数爱好者来说还是一个比较新的产品平台。如果两者放在一起融化会发生什么事情呢?来自Hulu公司的资深研发主管梁宇明为大家讲解了这一神奇的经历。他的演讲题目是《Voidbox - Docker On YARN在Hulu的实践》。因为基于YARN的大数据计算平台使得不同的计算框架可以在同一集群中混合部署,进而提升了集群资源利用率。
My talk at ScaleConf 2017 in Cape Town on some tips and tactics for scaling WordPress, with reference to WordPress.com and the container-based VIP Go platform.
Video of my talk is here: https://www.youtube.com/watch?v=cs0DcY80spw
The Good, the Bad and the Ugly of Networking for Microservices by Mathew Lodg...Docker, Inc.
Ugly connectivity challenges in your development and production environments.
The good: Advances in container networking in the past year, including the emergence of “Micro SDNs” as the way to simplify Docker deployments
The bad: Understanding live network behavior and troubleshooting
The ugly: Multicast, security, robustness and resiliency at scale
In this talk you will learn how to weave Dockerized microservices together without tying yourself in knots or putting your head in a noose. You’ll learn how to effectively use micro SDNs, service discovery and request routing. You'll also see how to solve the bad and the ugly connectivity challenges in your development and production environments.
- Emilien Macchi & Chmouel Boudjnah (eNovance)
Emilien et Chmouel sont tous deux développeurs OpenStack et sont de forts contributeurs aux projets Swift et Quantum. Ils introduiront le meetup en donnant une update sur les projets, les fonctionnalités de la release Grizzly et ce que nous pouvons attendre de la release Havana qui se dessinera à l'OpenStack Summit de Portland. Ils présenteront également un rapide bilan sur: "OpenStack: 3 ans après: qui sont les plus gros contributeurs du projet?"
ZF2 takes a different approach to services; there are several services out there and you should be providing the ability for ZF2 to integrate with this. ZF2 marries services with composer and a different packaging mechanism to ensure that services can be released without a specific framework version. This not only helps the framework but helps you prevent an API changing in between framework releases without having an issue of awaiting a framework release.
Presentation on sending push notifications with Zend Framework based on work to create Zend_Mobile_Push. Currently handles APNs (iPhone/iPad/iTouch), C2DM (Android) and MPNS (Windows Mobile). Additionally mentions of sending push notifications with WAP PAP (BlackBerry).
Mobile: for push and sync. Goes through implementing push notifications with PHP on the various 4 major players: Android (C2DM), Apple (APNS), Windows Phone (MPNS), BlackBerry (maybe works?).
So, you know how to deploy your code, what about your database? This talk will go through deploying your database with LiquiBase and DBDeploy a non-framework based approach to handling migrations of DDL and DML.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
How world-class product teams are winning in the AI era by CEO and Founder, P...
Varnish Cache
1. Northeast PHP August 12, 2012
Varnish, The Good, The
Awesome, and the
Downright Crazy
By Mike Willbanks
Sr. Web Architect Manager
NOOK Developer
2. Housekeeping…
• Talk
Slides will be online later!
• Me
Sr. Web Architect Manager at NOOK Developer
Prior MNPHP Organizer
Open Source Contributor (Zend Framework and various others)
Where you can find me:
• Twitter: mwillbanks G+: Mike Willbanks
• IRC (freenode): mwillbanks Blog: http://blog.digitalstruct.com
• GitHub: https://github.com/mwillbanks
2
3. Agenda
• What is Varnish
• The Good : Why…
The quick, easy and hardly informed way…
• The Awesome : How…
VCL’s, Directors and more…
• The Crazy : Go…
ESI, Purging, VCL C, and VMOD…
• Varnish Command Line Apps
varnishtop, varnishstat, etc.
3
5. Official Statement
“Varnish is a web application accelerator. You install it in
front of your web application and it will speed it up
significantly.”
5
6. What The Hell? Tell me!
• Varnish allow you to accelerate your website
By using memory and keeping in mind cookies, request headers
and more…
• It caches pages so that your web server can RELAX!
What about my apache, tomcat, nginx and (mongrel|thin|
goliath….)
Generally caching by TTL + HTTP Headers (cookies too!)
• A load banancer, proxy and more…
What? …. Yes, it can do that!
6
7. A General Use Case
• CaringBridge Status Server
Getting a message to mobile users.
The system is down, or we want to be able to communicate a
message to them about some subject… maybe a campaign.
The apps and mobile site rely on an API
• Trouble in paradise? Few and far in between.
Let an API talk to a server…
A story on crashing and burning before varnish.
7
8. The Graph - AWS
Req/s Peak Load
700 14
600 12
500 10
400 8
300 Req/s Peak Load
6
200 4
100
2
0
0
Small X-Large Small Varnish
Small X-Large Small Varnish
Time Requests
500 80000
450 70000
400
60000
350
300 50000
250 40000
Time Requests
200 30000
150
20000
100
50 10000
0 0
8 Small X-Large Small Varnish Small X-Large Small Varnish
9. The Raw Data
Small
X-‐Large
Small
Varnish
Concurrency
10
150
150
Requests
5000
55558
75000
Time
438
347
36
Req/s
11.42
58
585
Peak
Load
11.91
8.44
0.35
19,442
Comments
failed
reqs
9
10. The Good – Listen Up!
Installment
Documentation
Finding Existing VCL’s
11. Installment
• RTM : http://goo.gl/hl4Tt
Debian: sudo apt-get install varnish
EPEL: yum install varnish
• only 6.x otherwise you’ll be out of date!
WOOT Compiling #git
• git clone git://git.varnish-cache.org/varnish-cache
• cd varnish-cache
• sh autogen.sh
• ./configure
• make && make install
11
12. Varnish Daemon
• varnishd
-a address[:port] listen for client
-b address[:port] backend requests
-T address[:port] administration http
-s type[,options] storage type (malloc, file, persistence)
-P /path/to/file PID file
Many others; these are generally the most important. Generally
the defaults will do with just modification of the default VCL
(more on it later).
12
13. Documentation
• Reference Manual
https://www.varnish-cache.org/docs/3.0/reference/index.html
• Tutorial – more like a book version of the reference manual
https://www.varnish-cache.org/docs/3.0/tutorial/index.html
• Knock yourselves out! There is a ton of documentation
• Yes, this makes happy developers.
Documentation is very accurate, read carefully.
Focus heavily on VCL’s, that is generally what you need.
I’m attempting to show you some of how this works but you will
require the documentation to assist you.
13
14. Existing VCL’s – The truly lazy…
• VCL’s are available for common open source projects
Hi wordpress and drupal!
• https://www.varnish-cache.org/trac/wiki/VarnishAndWordpress
• https://www.varnish-cache.org/trac/wiki/VarnishAndDrupal
Examples of all sorts of crazy
• https://www.varnish-cache.org/trac/wiki/VCLExamples
14
15. Wordpress = Bad Slashdot Bad!!!
backend default {
.host = "127.0.0.1“;
.port = "8080";
}
sub vcl_recv {
if (!(req.url ~ "wp-(login|admin)")) {
unset req.http.cookie;
}
}
sub vcl_fetch {
if (!(req.url ~ "wp-(login|admin)")) {
unset beresp.http.set-cookie;
}
}
15
16. The Awesome – Going Places
VCL
Directors
A Few Examples
18. VCL – Varnish Configuration Language
• VCL State Engine
Each Request is Processed Separately & Independently
States are Isolated but are Related
Return statements exit one state and start another
VCL defaults are ALWAYS appended below your own VCL
• VCL can be complex, but…
Two main subroutines; vcl_recv and vcl_fetch
Common actions: pass, hit_for_pass, lookup, pipe, deliver
Common variables: req, beresp and obj
More subroutines, functions and complexity can arise dependent
on condition.
18
19. VCL – Subroutines – breaking it down.
• vcl_init – VCL is loaded, no request yet; VMOD initialization
• vcl_recv – Beginning of request, req is in scope
• vcl_pipe – Client & backend data passed unaltered
• vcl_pass – Request goes to backend and not cached
• vcl_hash – call hash_data to add to the hash
• vcl_hit – called on request found in the cache
• vcl_miss – called on request not found in the cache
• vcl_fetch – called on document retrieved from backend
• vcl_deliver – called prior to delivery of cached object
• vcl_error – called on errors
19
• vcl_fini – all requests have exited VCL, cleanup of VMOD’s
20. VCL - Variables
• Always Available • Backend Req Prepartion
now – epoch time bereq – backend request
• Backend Declarations • Retrieved Backend Request
.host – hostname / IP beresp – backend response
.port – port number • Cached Object
• Request Processing obj – Cached object, can only
client – ip & identity change .ttl
server – ip & port • Response Preparation
req – request information resp – http stuff
20
21. VCL - Functions
• hash_data(string) – adds a string to the hash input.
Request host and URL is default from the default vcl.
• regsub(string, regex, sub) – substitution on first occurance
sub can contain numbers 0-n to inject matches from the regex.
• regsuball(string, regex, sub) – substitution on all occurances
• ban(expression) – Ban all objects in cache that match
• ban(regex) – Ban all objects in cache that have a URL match
21
22. Directors
• Directors allow you to talk to the backend servers
• Directors are a glorified reverse proxy
Allows for certain types of load balancing
Allows for talking to a cluster
“A director is a logical group of backend servers
clustered together for redundancy. The basic role of
the director is to let Varnish choose a backend server
amongst several so if one is down another can be
used.”
22
23. Directors – The Types
• Random Director – picks a backend by random number
• Client Director – picks a backend by client identity
• Hash Director – picks a backend by URL hash value
• Round-Robin Director – picks a backend in order
• DNS Director – picks a backend by means of DNS
Random OR Round-Robin
• Fallback – picks the first “healthy” backend
23
24. Director - Probing
• To ensure healthy backends, you need to use probing.
It really sounds like a colonoscopy for servers; which it is.
• Variables
.url
.request
.window
.threshold
.intial
.expected_response
.interval
.timeout
24
27. ESI – Edge Side Includes
• ESI is a small markup language much like SSI (server side
includes) to include fragments (or dynamic content for that
matter).
• Think of it as replacing regions inside of a page as if you
were using XHR (AJAX) but single threaded.
• Three Statements can be utilized.
esi:include – Include a page
esi:remove – Remove content
<!-- esi --> - ESI disabled, execute normally
27
29. Using ESI
• In vcl_fetch, you must set ESI to be on
set beresp.do_esi = true;
By default, ESI will still cache, so add an exclusion if you need it
• if (req.url == “/show_username.php”) {
return (pass);
}
• This is a good thing, you may want to cache user information to the
right people (aka by cookie value) so that you don’t reload it on every
request.
Varnish refuses to parse content for ESI if it does not look like XML
• This is by default; so check varnishstat and varnishlog to ensure that it
is functioning like normal.
29
30. ESI – By Example
<html>
<head><title>Rock it with ESI</title></head>
<body>
<header>
<esi:include src="/user_header.php" />
<!-- Don't do this as you'd lose the advantage of varnish -->
<!--esi
<?php include 'user_header.php'; ?>
-->
</header>
<section id="main"></section
<footer></footer>
</body>
</html>
30
31. Purging
• The various ways of purging
varnishadm – command line utility
• It’s the ole finger in the back of the throat
Sockets (port 6082) – everyone likes a good socket wrench
• Sure, Ipecac is likely overkill.
HTTP – now that is the sexiness
• A few headers, nothing forced.
31
33. Distributed Purging
• Distributed Purging… like a sorority party.
Use a message queue (or gearman job server)
Have a worker that knows about the varnish servers
Submit the request to clear the cache in the asynchronously or
synchronously depending on your use case.
• Have enough workers to make this effective at purging the cache
quickly.
This will make it far easier to scale; you can either store the
servers in a config file, database or anything else you think is
relevant.
33
34. Embedding C in VCL – you must be crazy
• Before getting into VMOD; did you know you can embed C
into the VCL for varnish?
• Want to do something crazy fast or leverage a C library for
pre or post processing?
• I know… you’re thinking that’s useless..
On to the example; and a good one from the Varnish WIKI!
34
35. VCL - Embedded C for syslog – uber sexy
C{
#include <syslog.h>
}C
sub vcl_something {
C{
syslog(LOG_INFO, "Something happened at VCL line XX.");
}C
}
# Example with using varnish variables
C{
syslog(LOG_ERR, "Spurious response from backend: xid %s request %s %s
"%s" %d "%s" "%s"", VRT_r_req_xid(sp), VRT_r_req_request(sp),
VRT_GetHdr(sp, HDR_REQ, "005host:"), VRT_r_req_url(sp),
VRT_r_obj_status(sp), VRT_r_obj_response(sp), VRT_GetHdr(sp, HDR_OBJ,
"011Location:"));
}C
35
36. VMOD – Varnish Modules / Extensions
• Taking VCL embedded C to the next level
• Allows you to extend varnish and create new functions
• Now, if you are writing modules for varnish you have a
specialty use case!
Go read up on it!
https://www.varnish-cache.org/docs/trunk/reference/vmod.html
36
37. VMOD - std
• The VMOD std is shipped with varnish; it provides some
useful commands
toupper syslog
tolower fileread
set_up_tos duration
random integer
log collect
37
41. Logging
• Many times people want to log the requests to a file
By default Varnish only stores these in shared memory.
Apache Style Logs
• varnishncsa –D –a –w log.txt
This will run as a daemon to log all of your requests on a separate
thread.
41
43. Cache Warmup
• Need to warm up your cache before putting a sever in the
queue or load test an environment?
varnishreplay –r log.txt
• Replaying logs can allow you to do this. This is great for
when you are going to be deploying code to check for
performance issues.
Although… be careful so that you don’t POST data or create data
on peoples accounts. Maybe cat the file and remove anything that
executes on data.
43
44. Cache Hit Ratios? No Problem
• How to see your cache hit ratios…
varnishstat
• Want to parse them from XML so you can create a sexy
administration panel?
varnishstat –x
44