Varnish is a high-performance reverse proxy and load-balancer package for Linux/Unix systems.

learn more… | top users | synonyms

101
votes
12answers
99k views

How to set up Nginx as a caching reverse proxy?

I heard recently that Nginx has added caching to its reverse proxy feature. I looked around but couldn't find much info about it. I want to set up Nginx as a caching reverse proxy in front of ...
19
votes
2answers
8k views

Is Varnish with nginx better than just using nginx? [closed]

I see a lot of talk about using nginx with Varnish and I do not understand why. Isn't nginx enough? Nginx has SSI, has reverse proxy cache, is lightweight, has SSL, can work with cgi, fpm, etc. ...
14
votes
3answers
10k views

Ordering: 1. nginx 2. varnish 3. haproxy 4. webserver?

I've seen people recommend combining all of these in a flow, but they seem to have lots of overlapping features so I'd like to dig in to why you might want to pass through 3 different programs before ...
13
votes
3answers
7k views

How to check if chosen Varnish cache size is ideal?

I've configured my Varnish cache to use a cache size of 512 MB, using: varnishd ... -s file,/var/cache/varnish.cache,512M Questions: How do I monitor if 512 MB is too small, too big or okay? How ...
13
votes
2answers
4k views

Varnish versus other reverse proxies

I'm working with an organisation that has deployed Varnish as a caching reverse proxy for all of their web traffic. Their traffic make up is a lot of customer-generated dynamic websites, with the ...
12
votes
4answers
6k views

Nginx Varnish Nginx Django?

I have a django app and I want to to setup Varnish on a server in front of it. In another serverfault thread somebody suggested putting Nginx in front of Varnish. Should I put Nginx in front of ...
11
votes
7answers
2k views

How can I balance incoming web traffic amongst N apache servers?

I am looking to use something like Heartbeat/Squid/Varnish/etc to balance the amount of incoming traffic amongst the internal apache instances. This would have to be software and not hardware as all ...
8
votes
2answers
7k views

Varnish Cache - default TTL?

I have discovered that I can set the TTL in Varnish as follows in my VCL file: sub vcl_fetch { # 1 minute set obj.ttl = 1m; } But what is the default setting (assuming the backend server is ...
8
votes
7answers
5k views

Varnish -> Nginx -> Apache a good idea?

I'm thinking about the architecture for a new Webserver. Would having Varnish as a cache in front of Nginx as a reverse-proxy and serving static files in front of apache for all heavy lifting be a ...
8
votes
1answer
4k views

The strange case of Mr. Time To First Byte

I've got a webserver on a Linode 1024 VPS based on Ubuntu 11.10 Nginx 1.0.5 PHP 5.3.6 (with PHP-FPM, APC) Varnish 3.0.2 And a couple of blogs there based on WordPress 3.3.1. One of them is a ...
8
votes
2answers
6k views

Custom 503 Error Page With Varnish

How can I tell Varnish to show a custom html error page instead of the default "Guru Meditation" message?
8
votes
1answer
1k views

Poor load balancer performance on rackspace and centos

I am load testing different options for load balancing, and am getting poor results from Nginx, haproxy, and varnish. I have one 4GB load balancer at Rackspace, hitting 4x1GB app servers. I'm ...
8
votes
1answer
731 views

How does Varnish deal with running out of storage?

I am using Varnish 3.0.3 (the latest as of this writing) with more or less the default install, using the following for storage: # # Cache file location ...
7
votes
2answers
2k views

How to install a Varnish module on Ubuntu

I want to install an additional module for Varnish Cache, the Shield module. How can I do that? I installed Varnish 3.0 from the Ubuntu repositories. How do I get the Varnish source which the module ...
7
votes
5answers
3k views

Which reverse-proxies support HTTP/1.1 ETag and If-None-Match headers?

I'm developing a caching system for an ecommerce platform that will use a reverse proxy for caching. I plan to handle invalidation by using proper HTTP/1.1 headers. That is, I will set an ETag on ...
6
votes
2answers
581 views

Force request to miss cache but still store the response

I have a slow web app that I've placed Varnish in front of. All of the pages are static (they don't vary for a different user), but they need to be updated every 5 minutes so they contain recent data. ...
6
votes
3answers
7k views

Why cache static files with Varnish, why not pass

I have a system runnning nginx / php-fpm / varnish / wordpress and amazon s3. Now I have looked at a lot of configuration files while setting up the system, and in all of them I found something like ...
6
votes
3answers
804 views

Optimizing Server Architecture with Apache/Varnish/MySQL on Linux

I am a server administrator for a small start-up as a side venture (meaning I am by no means a well seasoned expert on the subject), and I recently helped move the site from a single windows machine ...
6
votes
1answer
627 views

Varnish running out of open ports, lots of SYN_SENT connections

Recently we've been experiencing issues with our Varnish (3x) -> Apache (3x) setup, resulting in a huge spike in SYN_SENT connections. The spike itself is due to the amount of new traffic hitting the ...
5
votes
2answers
8k views

Need HAproxy + Varnish + nginx setup suggestions

Currently, I have two load balancers running HAProxy, which forward requests to backends, each of which run Varnish cache in front of nginx. I thought this would distribute most the bandwidth across ...
5
votes
3answers
7k views

Configuring Varnish to rewrite Expires/Cache-Control headers for client-side caching

How do I configure Varnish so that all responses to requests matching say "*.css" gets cached in the client's browser for 30 days? What I'm trying to achieve is making Varnish set the correct ...
5
votes
1answer
8k views

nginx with Memcache Vs Varnish

I was wondering if anyone has any comments / benchmarks / suggestions on Varnish Vs Memcache when used to serve content (usually 2-5kb JS file depending on the parameters in request; thousands of diff ...
5
votes
2answers
8k views

Varnish configuration to only cache for non-logged in users

I have a Ruby on Rails application fronted by varnish+nginx. As most of the sites content is static unless you are a logged in user, I want to cache the site heavily with varnish when a user is logged ...
5
votes
3answers
3k views

Tools for introspecting Varnish

Has anyone developed, or does anyone know of, any third-party tools (or non-obvious uses of the stock tools) to help a poor systems administrator determine what's going on with requests that are ...
5
votes
2answers
2k views

Main differences between SSI (Server Side Include) and ESI (Edge Side include)

I need to include dynamic content into static pages at web server level. The 2 options I have found so far are Server Side Include (SSI) and Edge Side Include (ESI). While the origins of SSI seem ...
5
votes
1answer
920 views

Use Cherokee Instead of nginx in Front of Varnish to Get HTTP 1.1 Optimizations?

We have been running nginx -> uWSGI, and now we are evaluating putting Varnish as a caching layer between nginx and uWSGI (similar to http://www.heroku.com/how/architecture). But, nginx only supports ...
4
votes
4answers
12k views

Simple way of restarting crashed processes?

I need to monitor several processes running on my webserver. For some reason, varnish currently crashes once every day or two. I'm using monit to supposedly restart varnish automatically, but it ...
4
votes
7answers
2k views

Scaling large file downloads?

We currently deliver large (1GB+) files via a single Apache server, but our Apache server is extremely disk-IO-bound and we need to scale. My first idea was to simply duplicate this Apache server, ...
4
votes
1answer
2k views

Confused about caching solution: MemCache, Varnished, mod_cache, else?

I have a very heavy site in my server. The load of the server is always about 30-50 and sometimes it become even 150 and server work really hard. I'm looking for a caching solution that can increase ...
4
votes
4answers
2k views

How do I get varnish to return in the http response header from which backend it took the response?

I have three servers in the backend, with a round robin director. I would like varnish to write a X-Server-By header with the name or ip of the server from which the response was fetched, how can ...
4
votes
3answers
849 views

Let varnish send old data from cache while it's fetching a new one?

I'm caching dynamically generated pages (PHP-FPM, NGINX) and have varnish in front of them, this works very well. However, once the cache timeout is reached, I see this: new client requests page ...
4
votes
2answers
2k views

How to setup Nginx with Varnish

I'd like to see how to configure Nginx and Varnish. I'm running several PHP sites and Rack-Sinatra sites as virtual hosts across two IP's. I'd like to prevent Nginx from having to serve static ...
4
votes
1answer
533 views

How do I set a varnish response TTL dynamically?

my php script is sending a header X_Cache_ttl: 1h and in my varnish config file I have sub vcl_fetch { if(beresp.http.X-Cache-ttl){ set beresp.ttl = beresp.http.X-Cache-ttl; } } ...
4
votes
1answer
4k views

Serving application HTTP/5xx error pages via Varnish

I an working on running a few Rails applications through Varnish to provide better caching support which will hopefully be more flexible then the build in page-cache options in rails. One issue I ...
4
votes
2answers
489 views

Can varnish cache files without specific extension or residing in specific directory

I have a varnish installation to cache (MANY) images that my service serves. It is about 200 images of around 4k per second and varnish happily serves them according to the following rule: if ...
4
votes
1answer
1k views

Monitoring Varnish with Heartbeat and Pacemaker

I have a pair of servers setup as high availability load balancers/reverse proxies. Each runs Ubuntu 12.04 x64 Server, Varnish, Heartbeat and Pacemaker, with Varnish load balancing traffic to back-end ...
4
votes
2answers
3k views

Adding a reverse proxy - nginx or varnish

We currently serve most of our Rails and LAMP apps over Apache and Apache passenger, but we're considering adding Nginx or Varnish as a reverse proxy to reduce the load on our servers somewhat. I'm ...
4
votes
1answer
395 views

Varnish + Tomcat vs Apache + mod_jk + Tomcat

Does anyone have some performance metrics for Varnish in front of 1) Tomcat or 2) Apache with mod_jk (connected to Tomcat). I know that the AJP connector is supposedly faster than HTTP, but I was ...
4
votes
1answer
322 views

Combining Heroku with custom external services (e. g. Varnish or Postgres on EC2)

I'm planning to set up a Django site on Heroku. It will run on Heroku's Cedar stack, which allows Python apps, but doesn't include or support HTTP upstream caching with Varnish like the other stacks ...
4
votes
2answers
574 views

ratelimit POST requests

Im running a large wordpress multiuser site. I have a varnish cache infront of the wordpress application server. As it make no sense to cache POST requests, i am vulnerable to DOS using lots of POST´s ...
4
votes
1answer
1k views

Varnish doesn't seem to be caching

I've setup a Varnish cache mirror to sit in front of a file server, but it seems to be endlessly re-downloading data from my file server. There's about 100GB of data in total, but so far Varnish has ...
4
votes
3answers
1k views

Varnish only cache assets from single session

Currently I manage to configure varnish to cache items from 1 user, but the when the second users comes in varnish fetch another asset from Apache. How can I cache static assets behind magento ( ...
4
votes
0answers
778 views

Varnish “FetchError no backend connection” error

Varnishlog: 0 CLI - Rd ping 0 CLI - Wr 200 19 PONG 1340829925 1.0 12 SessionOpen c 79.124.74.11 3063 :80 12 SessionClose c EOF 12 StatSess c 79.124.74.11 3063 ...
3
votes
5answers
9k views

How many reverse proxies (nginx, haproxy) is too many?

I'm setting up a HA (high availability) cluster using nginx, haproxy & apache. I've been reading great things about nginx and haproxy. People tend to choose one or the other but I like both. ...
3
votes
1answer
2k views

Configuring HTTPD behind Varnish on a 512mb VPS

I am hosting a website for a client on a dedicated VPS that has 512mb of RAM. Within the last 2 weeks, it has hosed up twice due to 0% free memory (or free swap). The site is pretty database ...
3
votes
2answers
744 views

PHP serving blank pages to <1% of users

We recently migrated our site to a load balanced apache cluster behind varnish. Since that time a very small subset of users is reporting they cannot view any pages. I have narrowed the issue down ...
3
votes
1answer
3k views

Varnish 503 when delivering a slow page

Varnish keeps throwing 503 Service Unavailable when trying to load a page that takes longer to generate on the web server. In varnishlog I can see an FetchError c http read error: 0 error, though ...
3
votes
6answers
1k views

Fail-over caching reverse proxy

Is there a way to configure varnish or any other caching reverse proxy, to serve pages from its cache when the back-end fails? At the moment, if the back-end goes down a 503 Service Unavailable error ...
3
votes
2answers
3k views

How to filter Varnish logs based on XID?

I'm running into infrequent 503 errors which appear hard to pinpoint. Varnishlog is driving me mad, since I can't seem to get the information I want out of it. I'd like to see both the client- and ...
3
votes
3answers
3k views

How do you remove varnish?

I have a site that is currently using Varnish for caching HTTP requests, however for several reasons it is doing more harm than good. My problem is that I can't find a way to stop all http requests ...