we have a problem with Varnish caching the options (in our case available sizes that are in stock) on configurable product pages. Since our shop has a lot of products with low stock levels that is a huge problem for us. On one hand we want the performance on the other we need to display accurate stock levels at all times. So we thought the solution could be to load the options via Ajax but should do this. Thanks for your help!
I would suggest using https://github.com/nexcess/magento-turpentine, instead because you can hole-punch specific blocks with xml config.
<reference name="block name"> <action method="setEsiOptions"> <params> <access>private</access> <ttl>0</ttl> </params> </action> </reference>
Otherwise, you will have to write custom API.