Do you want to extend the functionality of Varnish? Make it modular!

Varnish has an ecosystem for third-party modules – Varnish Cache Modules (VMODs). A VMOD is a shared library that can be imported in your VCL code. VMODs allow you to use standard C libraries, meaning that you can extend the functionality of your Varnish servers.

Advantages of VMODs

VMODs have become more relevant since their introduction in Varnish Cache 3.0 because they inherit the advantages of modular programming. Algorithms in VMODs are easier to design and test particularly when using the Varnish testing script program varnishtest. Developing VMODs also helps developers to write more comprehensive and structured documentation because documentation is created as man pages. All this makes VMODs much easier to understand, and much easier for other developers to help you to find and troubleshoot bugs, specially when you add C programming language to your VCL code.

VMODs: the best way to extend your Varnish server

There is a long list of currently available VMODs. VMODs have proven advantageous to the degree that even some core functionalities of Varnish have been implemented as VMODs, for example: std, directors VMODs in Varnish Cache, and saintmode, rtstatus (real-time status) and xkey (surrogate keys) VMODs in Varnish Plus. What better proof is there that VMODs are the best way to extend your Varnish server? Get to work modularizing your code in VMODs!

Learn how to create your own VMOD

Writing VMODs is now made even easier with the boilerplate code provided by the example VMOD and the dedicated appendix in The Varnish Book to explain how to get started with VMODs. It explains all the basic concepts about VMODs.

The appendix contains exercises and solutions to teach the Varnish Test Case (VTC) language, used to design and test your VMODs and any other VCL program. It also explains in detail the Workspace Memory Model, which you must understand when developing VMODs. After learning the VTC language and Workspace Memory Model, the appendix shows you how to build your own VMOD on top of the example VMOD.

Share your VMOD with the Varnish Cache Community

We are looking forward to hearing how you extend your Varnish installation and hopefully see your VMODs listed soon in We hope you find the latest version of the Varnish book useful.

Download The Varnish Book

Topics: The Varnish Book, VCT, VCL, VMODs, varnishtest

26/10/15 12:53 by Francisco Velazquez

All things Varnish related

The Varnish blog is where the our team writes about all things related to Varnish Cache and Varnish Software...or simply vents.


Recent Posts

Posts by Topic

see all

Varnish Software Blog