VCL program naming

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Dec 4 11:29:46 CET 2008


I have never been quite happy with the current namespace for vcl
programs and the recent work on management tools have shown that
it is indeed not very practical.

Having pondered the question, I have come up with the following
idea instead: we add version numbers to the names of loaded VCLs,
and allow CLI commands to optionally be specify them.

Here is a mockup to show how it works:

$ varnishd -f myvcl.vcl -d -d ...
	[...]
vcl.list
   200 #
   active  21 boot:1	2008-12-04 10:03:06 UTC -f myvcl.vcl

	# The -b or -f argument, always turns into a VCL named "boot"
	# Notice the ":1" version number.

vcl.load test myvcl2.vcl
   200 #
vcl.list
   200 #
   active  34 boot:1	2008-12-04 10:03:06 UTC -f myvcl.vcl
   -	    0 test:1	2008-12-04 10:07:16 UTC myvcl2.vcl by stdin

	# we have loaded the test vcl, it gets version 1 as well.
	# VCLs do not get activated automatically.
	
vcl.use test
200 #
vcl.list
200 #
   -       34 boot:1	2008-12-04 10:03:06 UTC -f myvcl.vcl
   active   3 test:1	2008-12-04 10:07:16 UTC myvcl2.vcl by stdin

	# Now we are running the test vcl

vcl.load boot myvcl.vcl
   200 #
vcl.list
   200 #
   -       14 boot.1	2008-12-04 10:03:06 UTC -f myvcl.vcl
   -        0 boot:2	2008-12-04 10:08:34 UTC myvcl.vcl by stdin
   active  13 test:1	2008-12-04 10:07:16 UTC myvcl2.vcl by stdin

	# we have loaded another "boot" vcl and it gets version
	# number two.

vcl.use boot
   200 #
vcl.list
   200 #
   -       08 boot.1	2008-12-04 10:03:06 UTC -f myvcl.vcl
   active  12 boot:2	2008-12-04 10:08:34 UTC myvcl.vcl by stdin
   -       12 test:1	2008-12-04 10:07:16 UTC myvcl2.vcl by stdin

	# If no version is specified, the highst version number
	# is assumed.

vcl.discard test
   200 #
vcl.list
   200 #
   active  22 boot.1	2008-12-04 10:03:06 UTC -f myvcl.vcl
   -        6 boot:2	2008-12-04 10:08:34 UTC myvcl.vcl by stdin

	# Discard without version number removes all non-active VCLs
	# of that # name.

vcl.load boot myvcl.vcl
   200 #
vcl.list
   200 #
   active  22 boot.1	2008-12-04 10:03:06 UTC -f myvcl.vcl
   -        6 boot:2	2008-12-04 10:08:34 UTC myvcl.vcl by stdin
   -        0 boot:3	2008-12-04 10:10:51 UTC myvcl.vcl by stdin

	# Another version of the boot vcl

vcl.use boot:2
   200 #
vcl.list
   200 #
   -       18 boot.1	2008-12-04 10:03:06 UTC -f myvcl.vcl
   active  15 boot:2	2008-12-04 10:08:34 UTC myvcl.vcl by stdin
   -        0 boot:3	2008-12-04 10:10:51 UTC myvcl.vcl by stdin

	# We can say which exact version we want

vcl.discard boot
   200 #
vcl.list
   200 #
   active  15 boot:2	2008-12-04 10:08:34 UTC myvcl.vcl by stdin

	# And discard without version purges all non-active versions,
	# even if they are higher version numbers than the active.

vcl.list -d
   200 #
   discard  7 boot.1	2008-12-04 10:03:06 UTC -f myvcl.vcl
   active  23 boot:2	2008-12-04 10:08:34 UTC myvcl.vcl by stdin
   discard  2 test:1	2008-12-04 10:07:16 UTC myvcl2.vcl by stdin

	# the -d option also shows discarded VCLs that are still not
	# cleaned up, because sessions still reference them.

Input & comments welcome!

Poul-Henning

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-misc mailing list