Ways to handle large VCL files


Fastly currently only supports 64k files. There are some cases where files can grow beyond 64k.

I have been asking and looking for ways to reduce the file size and to break up these files and make them more manageable.

One thing some large VCL files seem to do is of some sort of IP filtering.
All of the conditionals have repeated characters and can take up a lot of space. Varnish does have a solution for this: ACLs.

Another thing I have seen people do with large files is break them up and use VCL include statements. This does not limit file size per se, but it does get around the size issue.

I am curious about other problems people are seeing with their VCL and their solutions.

I am looking for solutions to both complexity and code size.



Our VCL files contain ACLs limiting certain HTTP request methods to certain CIDR ranges. I have played around with using includes in VCL to ensure consistency of ACLs across our VCL templates, and I blogged a bit about how they’re used at http://ajlanghorn.com/2015/05/varnish-includes/

The branch is sat by the wayside right now whilst I build the same thing in ERB so we can pre-process before handing off the generated version to Fastly. Pre-processing in this way would follow our convention for doing this sort of stuff, but other than a few tweaks to the way you deploy your VCL (include files have to be marked separately), I see no real issue with the way this works over the use of the ERB templates.

It would be interesting to hear how you get on.