HAProxy / Varnish:redirect一定比例的stream量

我正在尝试为两个不同版本的网页测量单独的统计信息。 所以我需要将我的networkingstream量的一定比例redirect到不同于所请求的页面的页面(即page_1的请求的20%转到page_1.1)。
在我看来,清漆可以在本地统计stream量或请求。
我想我可以让Apache后端计算请求,插入一个自定义头,然后让Varnish发送一个重新启动到客户端,如果后端响应包含该特定的头。

任何想法或build议?

干杯,
杰里米

编辑:我忘了提及在光油前面有一个HAProxy istance,所以我在想另一个好办法做到这一点可以是:

关于HAProxy:
计数page1的请求
如果count> 80,则插入自定义标题
如果count = 100重置计数器

在清漆上
如果自定义头在请求问题客户端重新启动与page1-> page1.1重写

不知道如何用ACL,gpc0和stick-tables来做到这一点。 我正在学习寻找解决scheme:-)

一如既往,想法或build议是受欢迎的

我从来没有configuration一个清漆服务器,但我想这是可能的使用内置负载平衡器的循环configuration。

例如,如果你configuration4后端指向你的网站/页面的旧版本和1在新版本,像这样..

backend old1 { .host = "old.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } } backend old2 { .host = "old.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } } backend old3 { .host = "old.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } } backend old4 { .host = "old.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } } backend new { .host = "new.example.com"; .probe = { .url = "/"; .interval = 5s; .timeout = 1 s; .window = 5; .threshold = 3; } } 

然后有一个导演在他们之间循环…

 director blah round-robin { { .backend = old1; } { .backend = old2; } { .backend = old3; } { .backend = old4; } { .backend = new; } } 

该网站的new.example.com版本将获得20%的stream量。

这是一个黑客(有可能是一个更好的解决scheme),但我相信这将工作。