The document discusses Varnish, an open-source HTTP accelerator. It provides information on Varnish's architecture, which uses mmap to map the cache store into memory. It discusses various Varnish configuration options and parameters like object_workspace and thread pools. It also covers Varnish's domain specific language VCL which is used to define caching rules and behaviors.
Achieving the Ultimate Performance with KVMDevOps.com
Building and managing a cloud is not an easy task. It needs solid knowledge, proper planning and extensive experience in selecting the proper components and putting them together.
Many companies build new-age KVM clouds, only to find out that their applications & workloads do not perform well. Join this webinar to learn how to get the most out of your KVM cloud and how to optimize it for performance.
Join this webinar and learn:
Why performance matters and how to measure it properly?
What are the main components of an efficient new-age cloud?
How to select the right hardware?
How to optimize CPU and memory for ultimate performance?
Which network components work best?
How to tune the storage layer for performance?
This presentation discusses using the libvirt virtualization API for controlling bhyve virtual machines under FreeBSD.
Video for this presentation is available at:
https://www.youtube.com/watch?v=LRLV_SZo6Sw
XPDS14: libvirt support for libxenlight - James Fehlig, SUSEThe Linux Foundation
libvirt is an important piece of the overall open source virtualization management puzzle. Many of the open source virtualization management applications that users enjoy are based on libvirt, since it provides a normalized API for managing heterogeneous hypervisors. For Xen to enjoy this greater ecosystem of open source virtualization tools, it must be well supported and maintained in libvirt.
This presentation will give a basic overview of libvirt, discuss the latest status of the libvirt libxenlight driver (also known as the libxl driver), and discuss future improvements planned for the driver.
Using cobbler in a not so small environment 1.77chhorn
- cobbler basics
- why cobbler was chosen at a company
- how enterprise-requirements were met
- surrounding infrastructure (monitoring etc.)
- on community interaction
Practical information on how to Optimize Virtual Machines for High Performance by Boyan Krosnov, Chief Product Officer at StorPool Storage
Presentation delivered at OpenNebula TechDay Sofia on 25-th of February 2016
Performance Tuning a Cloud Application: A Real World Case Studyshane_gibson
During the OpenStack Icehouse summit in Atlanta, Symantec presented on our vision for a Key Value as a Service storage technology utilizing MagnetoDB. Since then our Cloud Platform Team has rolled the service out in our production environments. Through that process we have learned about tuning requirements of the solution on bare metal versus hosted VMs within an OpenStack environment.
Our initial performance testing was done with MagnetoDB running on bare metal nodes. After migrating the service from bare metal to an OpenStack VM hosted environment, we observed a 50% reduction in performance.
This presentation will dig into the details of the performance baselines, the tuning of the Nova Compute servers, Virtual Machine settings, and the applications itself to increase our performance.
Why larger community will be interested in this topic
This presentation will dig in to the technical details of performance tuning an application running on an OpenStack Nova Compute cluster. We will examine the performance related configuration settings necessary to improve the hosted application from three different angles:
the underlying compute node Operating System configuration
the hypervisor virtualization layer
and the Guest VM and Application stack
This presentation will provide a real world analysis of the steps taken. In addition, it will provide an outline for other cloud operators to follow when they work towards performance tuning their own cloud stack.
ok.ru is one of top 10 internet sites of the World, according to similarweb.com. Under the hood, it has several thousand servers. Each of those servers own only fraction of the data or business logic. Shared nothing architecture can be hardly applied to social network, due to its nature, so a lot of communication happens between these servers, diverse in kind and volume. This makes ok.ru one of the largest, complicated, yet highly loaded distributed systems in the world.
This talk is about our experience in building always available, resilient to failures distributed systems in Java, their basic and not so basic failure and recovery scenarios, methods of failure testing and diagnostics. We’ll also discuss on possible disasters and how to prevent or get over them.
Achieving the Ultimate Performance with KVMDevOps.com
Building and managing a cloud is not an easy task. It needs solid knowledge, proper planning and extensive experience in selecting the proper components and putting them together.
Many companies build new-age KVM clouds, only to find out that their applications & workloads do not perform well. Join this webinar to learn how to get the most out of your KVM cloud and how to optimize it for performance.
Join this webinar and learn:
Why performance matters and how to measure it properly?
What are the main components of an efficient new-age cloud?
How to select the right hardware?
How to optimize CPU and memory for ultimate performance?
Which network components work best?
How to tune the storage layer for performance?
This presentation discusses using the libvirt virtualization API for controlling bhyve virtual machines under FreeBSD.
Video for this presentation is available at:
https://www.youtube.com/watch?v=LRLV_SZo6Sw
XPDS14: libvirt support for libxenlight - James Fehlig, SUSEThe Linux Foundation
libvirt is an important piece of the overall open source virtualization management puzzle. Many of the open source virtualization management applications that users enjoy are based on libvirt, since it provides a normalized API for managing heterogeneous hypervisors. For Xen to enjoy this greater ecosystem of open source virtualization tools, it must be well supported and maintained in libvirt.
This presentation will give a basic overview of libvirt, discuss the latest status of the libvirt libxenlight driver (also known as the libxl driver), and discuss future improvements planned for the driver.
Using cobbler in a not so small environment 1.77chhorn
- cobbler basics
- why cobbler was chosen at a company
- how enterprise-requirements were met
- surrounding infrastructure (monitoring etc.)
- on community interaction
Practical information on how to Optimize Virtual Machines for High Performance by Boyan Krosnov, Chief Product Officer at StorPool Storage
Presentation delivered at OpenNebula TechDay Sofia on 25-th of February 2016
Performance Tuning a Cloud Application: A Real World Case Studyshane_gibson
During the OpenStack Icehouse summit in Atlanta, Symantec presented on our vision for a Key Value as a Service storage technology utilizing MagnetoDB. Since then our Cloud Platform Team has rolled the service out in our production environments. Through that process we have learned about tuning requirements of the solution on bare metal versus hosted VMs within an OpenStack environment.
Our initial performance testing was done with MagnetoDB running on bare metal nodes. After migrating the service from bare metal to an OpenStack VM hosted environment, we observed a 50% reduction in performance.
This presentation will dig into the details of the performance baselines, the tuning of the Nova Compute servers, Virtual Machine settings, and the applications itself to increase our performance.
Why larger community will be interested in this topic
This presentation will dig in to the technical details of performance tuning an application running on an OpenStack Nova Compute cluster. We will examine the performance related configuration settings necessary to improve the hosted application from three different angles:
the underlying compute node Operating System configuration
the hypervisor virtualization layer
and the Guest VM and Application stack
This presentation will provide a real world analysis of the steps taken. In addition, it will provide an outline for other cloud operators to follow when they work towards performance tuning their own cloud stack.
ok.ru is one of top 10 internet sites of the World, according to similarweb.com. Under the hood, it has several thousand servers. Each of those servers own only fraction of the data or business logic. Shared nothing architecture can be hardly applied to social network, due to its nature, so a lot of communication happens between these servers, diverse in kind and volume. This makes ok.ru one of the largest, complicated, yet highly loaded distributed systems in the world.
This talk is about our experience in building always available, resilient to failures distributed systems in Java, their basic and not so basic failure and recovery scenarios, methods of failure testing and diagnostics. We’ll also discuss on possible disasters and how to prevent or get over them.
Slides for a talk I gave at the Center for Media Design on 3.26.2010. Brad King and I each spoke for a few minutes about ways that BSU's SportsLink program might leverage mobile + social tools in distributing content and extending their brand.
Extending the Classroom: Conversations, Content, and Microblogging with TwitterBrian McNely
Slides from my 10.15.09 talk on Twitter, mobile devices, and pedagogy at Ball State University's Tech4U event, Schwartz Digital Complex, Bracken Library.
JavaOne 2010: Top 10 Causes for Java Issues in Production and What to Do When...srisatish ambati
Top 10 Causes for Java Issues in Production and What to Do When Things Go Wrong
JavaOne 2010.
Abstract: It's Friday evening and you hear the first rumble . . . one java node has become slightly unresponsive. You lookup the process, get a thread dump, and for good measure restart it at 8 p.m. Saturday afternoon is when you realize that other nodes have caught the flu and you get the ugly call from the customer. In a matter of hours, you're on that conference bridge with support groups of different packages and Java vendors and one of your uberarchitects. Yes, production instances are up and down, and restarting like there's no tomorrow. Here's an accumulated compendium of the op 10 things that can cause Java production heartburn and what to do when your Java production is on fire. And yes, please have your tools belt on.
Speaker(s):
Cliff Click, Azul Systems, Distinguished Engineer
SriSatish Ambati, Azul Systems, Performance Engineer
Flink Forward Berlin 2017: Robert Metzger - Keep it going - How to reliably a...Flink Forward
Let’s be honest: Running a distributed stateful stream processor that is able to handle terabytes of state and tens of gigabytes of data per second while being highly available and correct (in an exactly-once sense) does not work without any planning, configuration and monitoring. While the Flink developer community tries to make everything as simple as possible, it is still important to be aware of all the requirements and implications In this talk, we will provide some insights into the greatest operations mysteries of Flink from a high-level perspective: - Capacity and resource planning: Understand the theoretical limits. - Memory and CPU configuration: Distribute resources according to your needs. - Setting up High Availability: Planning for failures. - Checkpointing and State Backends: Ensure correctness and fast recovery For each of the listed topics, we will introduce the concepts of Flink and provide some best practices we have learned over the past years supporting Flink users in production.
Infrastructure review - Shining a light on the Black BoxMiklos Szel
Scenario: You work as a consultant and a new client has just signed on. Their DBA left suddenly leaving nothing but some outdated documentation in their wiki. After the kick-off meeting you realise that the operations and the development teams know little to none about the databases. They have been encountering intermittent problems with the application’s performance and suspect it’s related to the databases. You are told: "Please fix it ASAP!” So you have your public key installed on their jumphost and they manage to provide you with a 6 character long mysql root password. This is where your journey begins! During this session you will learn some of the best practices around discovering a new environment, finding possible threats and weaknesses and determining what key metrics to focus on for performance and reliability. We will cover architecture, replication, OS and MySQL level configuration, storage engines, failover strategies, backup and restores, monitoring, query tuning and possible ways to save money. The goal at the end of the presentation is to have a prioritized action plan. I will also explain the usage and the output of some tools/wrappers that help during an infrastructure review. Examples include creation of maximum integetr usage reports, table fragmentation and duplicate keys (we will be leveraging multiple Percona Toolkit scripts but also some lesser known tools as well). It is often easy to overlook underlying problems in the infrastructure during day-to-day operations, so this presentation will aim to highlight how to identify and resolve potential bottlenecks with your systems.
How we use Varnish at Opera Software, from the beginning (2009) to now.
Presentation hold for the 5th Varnish Users Group meeting (VUG5) held in Paris on March 22nd 2012.
Slides presented at Percona Live Europe Open Source Database Conference 2019, Amsterdam, 2019-10-01.
Imagine a world where all Wikipedia articles disappear due to a human error or software bug. Sounds unreal? According to some estimations, it would take an excess of hundreds of million person-hours to be written again. To prevent that scenario from ever happening, our SRE team at Wikimedia recently refactored the relational database recovery system.
In this session, we will discuss how we backup 550TB of MariaDB data without impacting the 15 billion page views per month we get. We will cover what were our initial plans to replace the old infrastructure, how we achieved recovering 2TB databases in less than 30 minutes while maintaining per-table granularity, as well as the different types of backups we implemented. Lastly, we will talk about lessons learned, what went well, how our original plans changed and future work.
Fast and easy method of installing one or more MySQL servers in isolation.
Includes latest development, hints of Gearman remote install, and a lightning talk
From common errors seen in running Spark applications, e.g., OutOfMemory, NoClassFound, disk IO bottlenecks, History Server crash, cluster under-utilization to advanced settings used to resolve large-scale Spark SQL workloads such as HDFS blocksize vs Parquet blocksize, how best to run HDFS Balancer to re-distribute file blocks, etc. you will get all the scoop in this information-packed presentation.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
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.
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.
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
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
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.
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/
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
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.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
13. mmap
• maps the store into memory
• (or alternatively use jemalloc)
• (makes kswapd use 100% cpu -- bad
linux)
• madvise(MADV_RANDOM)
• writev directly from mapped memory
Thursday, July 23, 2009
14. store
• not persistant between restarts
• (support in trunk)
• works really well with SSDs
• page in to evict :(
Thursday, July 23, 2009
15. logfile
• all headers
• no syscall!
• ring buffer
• just follow along
Thursday, July 23, 2009
16. workspaces
• allocated up front
• no malloc in normal execution path (except
ESI)
• aborts request on overflow
• (or panic)
• request + response headers + metadata
Thursday, July 23, 2009
17. configuration
/etc/default/varnish
# Maximum number of open files (for ulimit -n)
NFILES=131072
# Locked shared memory (for ulimit -l)
# Default log size is 82MB + header
MEMLOCK=90000
Thursday, July 23, 2009
18. configuration
/etc/default/varnish
# Maximum number of open files (for ulimit -n)
NFILES=131072
# Locked shared memory (for ulimit -l)
# Default log size is 82MB + header
MEMLOCK=90000
Thursday, July 23, 2009
23. obj_workspace=4096
• overhead per object
• scales with number of objects
• keep small
• can overflow from backend
• very large cookies
• very big headers
Thursday, July 23, 2009
24. sess_workspace=131072
• overhead per thread
• scratchpad for VCL work
• can overflow
• only panics if you do excessive copying in
VCL and then run out of space to compute
the hash
• probably want something smaller than 128k
Thursday, July 23, 2009
25. shm_workspace=32768
• overhead per thread
• temporary storage for logs
• tune to decrease shmlog mutex
• varnishstat -f shm_cont
Thursday, July 23, 2009
29. DAEMON_OPTS="-a :80
-T localhost:6082
-s file,/var/lib/varnish,140GB total number of max
-f /etc/varnish/default.vcl
-u varnish threads
-g users
-p obj_workspace=4096
-p sess_workspace=131072 careful to not let
-p shm_workspace=32768 threads run high in io
-p listen_depth=8192
-p ping_interval=2
pressure situations
-p log_hashstring=off
-h classic,250007
-p thread_pool_max=8000
-p lru_interval=60
-p esi_syntax=0x00000003
-p sess_timeout=10
-p thread_pools=8
-p thread_pool_min=500
-p srcaddr_ttl=0
-p thread_pool_add_delay=1"
Thursday, July 23, 2009
30. DAEMON_OPTS="-a :80
-T localhost:6082
-s file,/var/lib/varnish,140GB one threadpool per
-f /etc/varnish/default.vcl
-u varnish CPU
-g users
-p obj_workspace=4096
-p sess_workspace=131072 we want to force create
-p shm_workspace=32768 threads on startup so
-p listen_depth=8192
-p ping_interval=2
min of 500*8
-p log_hashstring=off
-h classic,250007
-p thread_pool_max=8000
-p lru_interval=60
-p esi_syntax=0x00000003
-p sess_timeout=10
-p thread_pools=8
-p thread_pool_min=500
-p srcaddr_ttl=0
-p thread_pool_add_delay=1"
Thursday, July 23, 2009
31. DAEMON_OPTS="-a :80
-T localhost:6082
-s file,/var/lib/varnish,140GB disable srcaddr_ttl!
-f /etc/varnish/default.vcl
-u varnish
-g users slows things down with
-p obj_workspace=4096
-p sess_workspace=131072 no benefit
-p shm_workspace=32768
-p listen_depth=8192
-p ping_interval=2
removed from trunk
-p log_hashstring=off
-h classic,250007
-p thread_pool_max=8000
-p lru_interval=60
-p esi_syntax=0x00000003
-p sess_timeout=10
-p thread_pools=8
-p thread_pool_min=500
-p srcaddr_ttl=0
-p thread_pool_add_delay=1"
Thursday, July 23, 2009
32. DAEMON_OPTS="-a :80
-T localhost:6082
-s file,/var/lib/varnish,140GB how long to wait
-f /etc/varnish/default.vcl between threads
-u varnish
-g users
-p obj_workspace=4096 default is 20ms
-p sess_workspace=131072
-p shm_workspace=32768
-p listen_depth=8192 far too long -- makes
-p ping_interval=2 startup cause failures
-p log_hashstring=off
-h classic,250007
-p thread_pool_max=8000
-p lru_interval=60
-p esi_syntax=0x00000003
-p sess_timeout=10
-p thread_pools=8
-p thread_pool_min=500
-p srcaddr_ttl=0
-p thread_pool_add_delay=1"
Thursday, July 23, 2009
33. -p 'cc_command=exec cc -fpic -shared -Wl,-x -L/usr/local/
lib/ -lGeoIP -o %o %s'
Thursday, July 23, 2009
34. shmlog on tmpfs
• shmlog is mlocked()
• still written to disk
• dirty buffers
• IO ≠ requests per second
tmpfs /var/lib/varnish/ tmpfs
noatime,defaults,size=150M 0 0
Thursday, July 23, 2009
35. vcl
• domain specific language
• translated into C
• compiled
• dynamically loaded and executed
• https://svn.wikia-code.com/utils/
varnishhtcpd/wikia.vcl
Thursday, July 23, 2009
36. vcl_recv
• first entry point
• results in
• pipe
• pass
• lookup
Thursday, July 23, 2009
37. sub vcl_recv {
# normalize Accept-Encoding to reduce vary
if (req.http.Accept-Encoding) {
if (req.http.User-Agent ~ "MSIE 6") {
unset req.http.Accept-Encoding;
} elsif (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate") {
set req.http.Accept-Encoding = "deflate";
} else {
unset req.http.Accept-Encoding;
}
}
(I hate browsers)
Thursday, July 23, 2009
38. sub vcl_recv {
# normalize Accept-Encoding to reduce vary
if (req.http.Accept-Encoding) {
if (req.http.User-Agent ~ "MSIE 6") {
unset req.http.Accept-Encoding;
} elsif (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate") {
set req.http.Accept-Encoding = "deflate";
} else {
unset req.http.Accept-Encoding;
}
}
(I hate browsers)
Thursday, July 23, 2009
39. # clean out requests sent via curls -X mode and LWP
if (req.url ~ "^http://") {
set req.url = regsub(req.url, "http://[^/]*","");
}
# lvs check
if (req.url == "/svccheck.html") {
error 200 "OK";
}
if (req.url == "/__ervername") {
error 200 "OK";
}
Thursday, July 23, 2009
40. # save the cookie for later use
set req.http.X-Orig-Cookie = req.http.Cookie;
if(req.http.Cookie ~ "(session|UserID|UserName|Token|LoggedOut)") {
# dont do anything, the user is logged in
} else {
# dont care about any other cookies
# for vary purposes
unset req.http.Cookie;
}
Thursday, July 23, 2009
41. # pipe post
if (req.request != "GET" && req.request != "HEAD" && req.request !=
"PURGE") {
pipe;
}
# dont cache Authenticate calls
# we dont use those?
if (req.http.Authenticate) {
pass;
}
set req.grace = 3600s;
lookup;
}
Thursday, July 23, 2009
42. vcl_pipe
• pipe switches to byte transfer mode
• no further work is done on the connection
Thursday, July 23, 2009
43. sub vcl_pipe {
# do the right XFF processing
# we chain XFF correctly
set bereq.http.X-Forwarded-For = req.http.X-Forwarded-For;
set bereq.http.X-Forwarded-For = regsub(bereq.http.X-Forwarded-For, "$", ", ");
set bereq.http.X-Forwarded-For = regsub(bereq.http.X-Forwarded-For, "$", client.ip);
# restore cookie
set bereq.http.Cookie = req.http.X-Orig-Cookie;
# we don’t want any more requests on this connection
# or XFF won’t work
set bereq.http.connection = "close";
}
varnish default XFF support is broken
Thursday, July 23, 2009
44. vcl_hit
• called on hit
• be careful
• DO NOT MODIFY THE OBJECT
• (except TTL)
• way to implement purging
• (remember to purge all Vary versions)
Thursday, July 23, 2009
45. sub vcl_hit {
if (req.request == "PURGE") {
set obj.ttl = 0s;
error 200 "Purged.";
}
}
Thursday, July 23, 2009
46. vcl_miss
• called on a miss
• just before fetch from backend
• can change the bereq object
Thursday, July 23, 2009
47. sub vcl_miss {
# tell the client the purge failed
if (req.request == "PURGE") {
error 404 "Not purged";
}
set bereq.http.X-Forwarded-For = req.http.X-Forwarded-For;
set bereq.http.X-Forwarded-For = regsub(bereq.http.X-Forwarded-For, "$", ", ");
set bereq.http.X-Forwarded-For = regsub(bereq.http.X-Forwarded-For, "$", client.ip);
# reset the cookie to what it was orignally
set bereq.http.Cookie = req.http.X-Orig-Cookie;
}
Thursday, July 23, 2009
48. vcl_fetch
• just after an object has been fetched
• request object
• cached object
Thursday, July 23, 2009
49. sub vcl_fetch {
if(req.url == "/robots.txt") {
set obj.http.X-Pass-Cache-Control = "max-age=86400";
set obj.ttl = 86400s;
}
if (!obj.cacheable) {
set obj.http.X-Cacheable = "NO:Not-Cacheable";
pass;
}
if (obj.http.Cache-Control ~ "private") {
if(req.http.Cookie ~"(UserID|_session)") {
set obj.http.X-Cacheable = "NO:Got Session";
} else {
set obj.http.X-Cacheable = "NO:Cache-Control=private";
}
pass;
}
if (obj.http.Set-Cookie ~ "(UserID|_session)") {
set obj.http.X-Cacheable = "NO:Set-Cookie";
pass;
}
Thursday, July 23, 2009
50. sub vcl_fetch {
if(req.url == "/robots.txt") {
set obj.http.X-Pass-Cache-Control = "max-age=86400";
set obj.ttl = 86400s;
}
if (!obj.cacheable) {
set obj.http.X-Cacheable = "NO:Not-Cacheable";
pass;
}
if (obj.http.Cache-Control ~ "private") {
if(req.http.Cookie ~"(UserID|_session)") {
set obj.http.X-Cacheable = "NO:Got Session";
} else {
set obj.http.X-Cacheable = "NO:Cache-Control=private";
}
pass;
}
if (obj.http.Set-Cookie ~ "(UserID|_session)") {
set obj.http.X-Cacheable = "NO:Set-Cookie";
pass;
}
Thursday, July 23, 2009
51. sub vcl_fetch {
if(req.url == "/robots.txt") {
set obj.http.X-Pass-Cache-Control = "max-age=86400";
set obj.ttl = 86400s;
}
if (!obj.cacheable) {
set obj.http.X-Cacheable = "NO:Not-Cacheable";
pass;
}
if (obj.http.Cache-Control ~ "private") {
if(req.http.Cookie ~"(UserID|_session)") {
set obj.http.X-Cacheable = "NO:Got Session";
} else {
set obj.http.X-Cacheable = "NO:Cache-Control=private";
}
pass;
}
if (obj.http.Set-Cookie ~ "(UserID|_session)") {
set obj.http.X-Cacheable = "NO:Set-Cookie";
pass;
}
Thursday, July 23, 2009
52. if ( obj.http.X-Pass-Cache-Control ) {
set obj.http.X-Internal-Pass-Cache-Control = obj.http.X-Pass-Cache-Control;
} elsif ( obj.status == 304 ) {
# no headers on if-modified since
} elsif ( req.url ~ ".*/index.php.*(css|js)"
|| req.url ~ "raw") {
# dont touch it let mediawiki decide
} elsif (req.http.Host ~ "images.wikia.com") {
# lighttpd knows what it is doing
} else {
set obj.http.X-Internal-Pass-Cache-Control = "private, s-maxage=0, max-age=0,
must-revalidate";
}
Seperate from cache-control since external cache-control
is not what we want varnish to follow
Thursday, July 23, 2009
53. if (obj.ttl < 1s) {
set obj.ttl = 5s;
set obj.grace = 5s;
set obj.http.X-Cacheable = "YES - FORCED";
deliver;
} else {
set obj.http.X-Cacheable = "YES";
if (obj.ttl < 600s) {
set obj.grace = 5s;
} else {
set obj.grace = 3600s;
}
}
Thursday, July 23, 2009
54. grace
• Serve stale object
• Fetch new object from background
• If backend dead serve stale
• Avoids thread pileups on invalidations
Thursday, July 23, 2009
55. URL coalescing
• Multiple front end requests
• One backend request
• Unlike Squid
• Wikipedia suffered when Michael Jackson
died because of cache storms
Thursday, July 23, 2009
56. if(obj.status == 404) {
set obj.http.Cache-Control = "max-age=10";
set obj.ttl = 10s;
set obj.grace = 10s;
}
deliver;
}
Thursday, July 23, 2009
57. vcl_deliver
• modify response object
• don’t modify the cached object
• no access to the request object
• (changed in next major version)
Thursday, July 23, 2009
58. #add or append Served By
if(!resp.http.X-Served-By) {
set resp.http.X-Served-By = server.identity;
if (obj.hits > 0) {
set resp.http.X-Cache = "HIT";
} else {
set resp.http.X-Cache = "MISS";
}
set resp.http.X-Cache-Hits = obj.hits;
} else {
# append current data
set resp.http.X-Served-By = regsub(resp.http.X-Served-By, "$", ", ");
set resp.http.X-Served-By = regsub(resp.http.X-Served-By, "$", server.identity);
if (obj.hits > 0) {
set resp.http.X-Cache = regsub(resp.http.X-Cache, "$", ", HIT");
} else {
set resp.http.X-Cache = regsub(resp.http.X-Cache, "$" , ", MISS");
}
set resp.http.X-Cache-Hits = regsub(resp.http.X-Cache-Hits, "$", ", ");
set resp.http.X-Cache-Hits = regsub(resp.http.X-Cache-Hits, "$", obj.hits);
}
Thursday, July 23, 2009
66. C code!
• Embed C code in the config
• Quite useful for
• Cookie inspection
• Generating Expire header
• Geoip generator
• varnishd -C -f to see generated code
Thursday, July 23, 2009
70. Geo = {"city":"White Plains","country":"US","lat":"41.029099","lon":"-73.758003","classC":"209.133.114.31","netmask":"23"}
geoiplookup.wikia.com
Thursday, July 23, 2009
71. 4725 SessionOpen c xxx.xxx.xxx.xxx 1441 :80
varnishlog
4774 ReqEnd - 0 1245712664.794090033 1245712664.794090033 0.003499746 0.000000000 0.000000000
4774 StatSess - xxx.xxx.xxx.xxx 1442 0 1 0 0 0 0 0 0
4749 SessionOpen c xxx.xxx.xxx.xxx 2748 :80
10216 ReqStart c xxx.xxx.xxx.xxx 51324 1570384079
10216 RxRequest c GET
10216 RxURL c /runescape/images/4/4c/Defence_cape.gif
10216 RxProtocol c HTTP/1.1
10216 RxHeader c Accept: */*
10216 RxHeader c Referer: http://runescape.wikia.com/wiki/Defence_cape
10216 RxHeader c Accept-Language: en-gb
10216 RxHeader c UA-CPU: x86
10216 RxHeader c Accept-Encoding: gzip, deflate
10216 RxHeader c User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; FunWebProducts; GTB6; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET
CLR 3.0.30618; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)
10216 RxHeader c Host: images3.wikia.nocookie.net
10216 RxHeader c Connection: Keep-Alive
10216 VCL_call c recv
10216 VCL_acl c NO_MATCH SJC
10216 VCL_acl c MATCH LON xxx.xxx.xxx.xxx
10216 VCL_return c lookup
10216 VCL_call c hash
10216 VCL_return c hash
10216 Hit c 1216457642
10216 VCL_call c hit
10216 VCL_return c deliver
10216 Length c 1851
10216 VCL_call c deliver
10216 VCL_acl c NO_MATCH LON
10216 VCL_acl c NO_MATCH SJC
10216 VCL_acl c NO_MATCH IOWA
10216 VCL_return c deliver
10216 TxProtocol c HTTP/1.1
10216 TxStatus c 200
10216 TxResponse c OK
10216 TxHeader c Cache-Control: max-age=30
10216 TxHeader c Content-Type: image/gif
10216 TxHeader c ETag: "209654623"
10216 TxHeader c Last-Modified: Thu, 12 Mar 2009 04:58:56 GMT
10216 TxHeader c Server: lighttpd/1.4.18
10216 TxHeader c Content-Length: 1851
Thursday, July 23, 2009
73. varnishncsa
xxx.xxx.xxx.xxx - - [23/Jul/2009:05:49:55 +0000] "GET http://gijoe.wikia.com/extensions/wikia/StaticChute/?
type=css&packages=monaco_css&checksum=a5dc11f8a009ce63aea7661b1ba330a8 HTTP/1.1" 200 16570 "http://gijoe.wikia.com/wiki/
Duke_(Movie)" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; GTB6; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR
3.0.04506; InfoPath.1)"
xxx.xxx.xxx.xxx - - [23/Jul/2009:05:49:55 +0000] "GET http://www.wowwiki.com/api.php?action=parse&prop=text&text={{:He%20Feeds%20On
%20Your%20Tears|mode=home}}&format=json HTTP/1.1" 200 928 "http://www.wowwiki.com/Algalon_the_Observer" "Mozilla/5.0 (Windows; U;
Windows NT 6.0; en-US; rv:1.9.0.12) Gecko/2009070611 Firefox/3.0.12"
xxx.xxx.xxx.xxx - - [23/Jul/2009:05:49:55 +0000] "GET http://images1.wikia.nocookie.net/uncyclopedia/images/thumb/b/bb/Wotm.jpg/70px-
Wotm.jpg HTTP/1.1" 304 0 "http://uncyclopedia.wikia.com/wiki/Main_Page" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/
530.5 (KHTML, like Gecko) Chrome/2.0.172.37 Safari/530.5"
xxx.xxx.xxx.xxx - - [23/Jul/2009:05:49:55 +0000] "GET http://banjokazooie.wikia.com/wiki/Jiggy_Switch HTTP/1.1" 200 11041 "-" "Mozilla/4.0
(compatible; MSIE 6.0; Windows NT 5.0;.NET CLR 1.0.3705; ContextAd Bot 1.0)"
Thursday, July 23, 2009
74. varnishhist
| cache hit
# cache miss
Thursday, July 23, 2009
75. 61+09:08:16 varnish9
Hitrate ratio: 10 16 16
Hitrate avg: 0.9274 0.9286 0.9286
1554133248 377.00 293.05 Client connections accepted
3978072764 867.00 750.11 Client requests received
3614483333 801.00 681.55 Cache hits
11639361 0.00 2.19 Cache hits for pass
325788549 61.00 61.43 Cache misses
182821195 19.00 34.47 Backend connections success
varnishstat
25954 0.00 0.00 Backend connections failures
175872686 19.00 33.16 Backend connections reuses
176615269 14.00 33.30 Backend connections recycles
35452 . . N struct sess_mem
52444 . . N struct sess
2605151 . . N struct object
2532375 . . N struct objecthead
5293878 . . N struct smf
48126 . . N small free smf
33357 . . N large free smf
93 . . N struct vbe_conn
1427 . . N struct bereq
2000 . . N worker threads
2000 0.00 0.00 N worker threads created
6447 0.00 0.00 N overflowed work requests
13496 0.00 0.00 N dropped work requests
19 . . N backends
163660934 . . N expired objects
1101311441 . . N LRU moved objects
2034 0.00 0.00 HTTP header overflows
2296939595 419.00 433.12 Objects sent with write
1554124359 368.00 293.05 Total Sessions
3978485680 863.00 750.19 Total Requests
Thursday, July 23, 2009
76. Performance
• Very fast
• 6 varnish machines handle all of Wikia
• 3 locations -- each location needs 1 varnish
• close to 800 mbit
Thursday, July 23, 2009
93. SSD Love
• Very cost effective
• I love them
• Random IO out of this world
• Varnish uses lots of random IO
Thursday, July 23, 2009
94. SSD optimisation
• noatime
• elevator doesn’t seem to matter
• turn off journal
• turn off readahead using hdparm
• turn off all readahead you can
• cut IO read rate by 10x 80 MB/sec > 8 MB/sec
• don’t use a RAID card
Thursday, July 23, 2009
98. ESI future
• Chain walking for if-modified-since
• Synthetic parts
• Gzip support
Thursday, July 23, 2009
99. Common problems
• Cache headers
• s-maxage = for varnish
• maxage = for clients
• Warning s-maxage also for other caches
• Treat varnish as part of your application
• X-Pass-Cache-Control hack
Thursday, July 23, 2009
100. Common problems 2
• Incorrect cache headers
• Cache minimum 1 sec
• prevents DOS to backend
• Cachebusters
• I hate you jquery!
• ?randomnumber f**k you
Thursday, July 23, 2009
101. Thank you
• artur@crucially.net
• varnish.projects.linpro.no
• #varnish irc.linprono
Thursday, July 23, 2009