VCL program naming

2008-12-04 Thread Poul-Henning Kamp

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:12008-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:12008-12-04 10:03:06 UTC -f myvcl.vcl
   -0 test:12008-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:12008-12-04 10:03:06 UTC -f myvcl.vcl
   active   3 test:12008-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.12008-12-04 10:03:06 UTC -f myvcl.vcl
   -0 boot:22008-12-04 10:08:34 UTC myvcl.vcl by stdin
   active  13 test:12008-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.12008-12-04 10:03:06 UTC -f myvcl.vcl
   active  12 boot:22008-12-04 10:08:34 UTC myvcl.vcl by stdin
   -   12 test:12008-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.12008-12-04 10:03:06 UTC -f myvcl.vcl
   -6 boot:22008-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.12008-12-04 10:03:06 UTC -f myvcl.vcl
   -6 boot:22008-12-04 10:08:34 UTC myvcl.vcl by stdin
   -0 boot:32008-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.12008-12-04 10:03:06 UTC -f myvcl.vcl
   active  15 boot:22008-12-04 10:08:34 UTC myvcl.vcl by stdin
   -0 boot:32008-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:22008-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.12008-12-04 10:03:06 UTC -f myvcl.vcl
   active  23 boot:22008-12-04 10:08:34 UTC myvcl.vcl by stdin
   discard  2 test:12008-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
[EMAIL PROTECTED] | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc


Re: Varnish Serves only uncompressed objects if they are requested first

2008-12-04 Thread Jeff Anderson
Our app servers are sending the Vary on the Accept-Encoding when  
compression is requested.  If compression is not requested they do not  
perform the Vary.  Does that mean we should find a way to send a Vary:  
Accept-Encoding:  null,gzip,deflate or something?  Is there a 'no  
compression' accept-encoding header?


On Dec 2, 2008, at 10:36 PM, Per Buer wrote:

 Jeff Anderson skrev:
 It looks like if the first requested page is for an uncompressed page
 varnish will only deliver the uncompressed page from cache even if a
 compressed page is requested.

 As long as you don't Vary: on the Accept-Encoding I guess that is
 expected. Varnish doesn't not understand the Accept-Encoding header.

 (..)
 What could be causing this?  The only way to fix appears to be to add
 the lines below:

 sub vcl_hash {
 if (req.http.Accept-Encoding ~ gzip || req.http.Accept-Encoding ~
 deflate) {
   set req.hash += req.http.Accept-Encoding;
 }

 Either use the fix you suggested or add a Vary: Accept-Encoding on the
 backend.

 -- 
 Per Buer - Leder Infrastruktur og Drift - Redpill Linpro
 Telefon: 21 54 41 21 - Mobil: 958 39 117
 http://linpro.no/ | http://redpill.se/

 ___
 varnish-misc mailing list
 varnish-misc@projects.linpro.no
 http://projects.linpro.no/mailman/listinfo/varnish-misc

___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc


Re: [varnish] Re: Varnish Serves only uncompressed objects if they are requested first

2008-12-04 Thread Ricardo Newbery


Your app server should set the Vary on *all* responses if *any*  
response can vary.

Ric



On Dec 4, 2008, at 11:59 AM, Jeff Anderson wrote:

 Our app servers are sending the Vary on the Accept-Encoding when
 compression is requested.  If compression is not requested they do not
 perform the Vary.  Does that mean we should find a way to send a Vary:
 Accept-Encoding:  null,gzip,deflate or something?  Is there a 'no
 compression' accept-encoding header?


 On Dec 2, 2008, at 10:36 PM, Per Buer wrote:

 Jeff Anderson skrev:
 It looks like if the first requested page is for an uncompressed  
 page
 varnish will only deliver the uncompressed page from cache even if a
 compressed page is requested.

 As long as you don't Vary: on the Accept-Encoding I guess that is
 expected. Varnish doesn't not understand the Accept-Encoding header.

 (..)
 What could be causing this?  The only way to fix appears to be to  
 add
 the lines below:

 sub vcl_hash {
 if (req.http.Accept-Encoding ~ gzip || req.http.Accept-Encoding ~
 deflate) {
  set req.hash += req.http.Accept-Encoding;
 }

 Either use the fix you suggested or add a Vary: Accept-Encoding on  
 the
 backend.

 -- 
 Per Buer - Leder Infrastruktur og Drift - Redpill Linpro
 Telefon: 21 54 41 21 - Mobil: 958 39 117
 http://linpro.no/ | http://redpill.se/

 ___
 varnish-misc mailing list
 varnish-misc@projects.linpro.no
 http://projects.linpro.no/mailman/listinfo/varnish-misc

 ___
 varnish-misc mailing list
 varnish-misc@projects.linpro.no
 http://projects.linpro.no/mailman/listinfo/varnish-misc

___
varnish-misc mailing list
varnish-misc@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-misc