JSONP cache busting varnish

Howard Rauscher howardr at gmail.com
Fri Apr 29 18:26:26 CEST 2011


My company had an interactive widget posted on the homepage of a very high
traffic media company during the Royal Wedding. We were hosting most of the
widget on Amazon S3, but every 5 seconds we polled our server via JSONP to
get updated stats about the event.

A couple of weeks ago we realized that JSONP effectively cache busts
varnish. I searched around the internet and found a novel way to use our
varnish server to mitigate this situation.

Here is an example of our VCL:
https://gist.github.com/f1d91b64acdb3f1d7769

At around 5:00am US CST (maybe earlier), about a 1/3 of our api through
varnish returned 503's. We ended up just removing the relevant JSONP
solution and let varnish to be cache busted. Now that the situation has
cooled off a little, I was wondering if I could get some advice on this
config.

Is this a good solution to the JSONP problem?

Our setup:

   - 6 EC2 servers (not sure which setup)
   - Each server had one varnish and one webapp
      - 7188 megs of ram each
      - 2 GB allocated to varnish
      - ~1500 req/s
      - 99.2% hit rate
      - And example backend success were ~600/s and backend failures were
      ~300/sec

An example url would be:
/username/streamname.json?jsonp=callback8&items=item1,item2

The 503 response would contained text "Guru Meditation:XID: 1518618356". Not
sure what that means though.

thanks,
Howard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110429/950efe25/attachment-0003.html>


More information about the varnish-misc mailing list