[PATCH] add a least-connection director
Tollef Fog Heen
tfheen at varnish-software.com
Thu Mar 29 10:31:29 CEST 2012
]] Federico G. Schwindt
Hi,
> On Sat, 21 Jan 2012 10:14:27 +0000
> "Federico G. Schwindt" <fgsch at lodoss.net> wrote:
>
> > Hi,
> >
> > The diff below adds a least-connection director based on the random director.
> > Documentation and tests included.
> > Comments? OKs?
>
> Updated diff against trunk.
Fails for me on make distcheck, any idea why?
**** top 0.0 macro def varnishd=../varnishd/varnishd
**** top 0.0 macro def pwd=/home/tfheen/varnish/bin/varnishtest
**** top 0.0 macro def topbuild=/home/tfheen/varnish/bin/varnishtest/../..
**** top 0.0 macro def bad_ip=10.255.255.255
**** top 0.0 macro def tmpdir=/tmp/vtc.27004.4c2262bf
* top 0.0 TEST tests/v00038.vtc starting
*** top 0.0 varnishtest
* top 0.0 TEST Test least-connection director
*** top 0.0 server
** s1 0.0 Starting server
**** s1 0.0 macro def s1_addr=127.0.0.1
**** s1 0.0 macro def s1_port=53652
**** s1 0.0 macro def s1_sock=127.0.0.1 53652
* s1 0.0 Listen on 127.0.0.1 53652
*** top 0.0 server
** s2 0.0 Starting server
** s1 0.0 Started on 127.0.0.1 53652
**** s2 0.0 macro def s2_addr=127.0.0.1
**** s2 0.0 macro def s2_port=45207
**** s2 0.0 macro def s2_sock=127.0.0.1 45207
* s2 0.0 Listen on 127.0.0.1 45207
*** top 0.0 server
** s3 0.0 Starting server
** s2 0.0 Started on 127.0.0.1 45207
**** s3 0.0 macro def s3_addr=127.0.0.1
**** s3 0.0 macro def s3_port=35684
**** s3 0.0 macro def s3_sock=127.0.0.1 35684
* s3 0.0 Listen on 127.0.0.1 35684
*** top 0.0 varnish
** s3 0.0 Started on 127.0.0.1 35684
** v1 0.0 Launch
*** v1 0.0 CMD: cd ${pwd} && ${varnishd} -d -d -n /tmp/vtc.27004.4c2262bf/v1 -l 10m,1m,- -p auto_restart=off -p syslog_cli_traffic=off -a '127.0.0.1:0' -S /tmp/vtc.27004.4c2262bf/v1/_S -M '127.0.0.1 48915' -P /tmp/vtc.27004.4c2262bf/v1/varnishd.pid -sfile,/tmp/vtc.27004.4c2262bf/v1,10M
*** v1 0.0 CMD: cd /home/tfheen/varnish/bin/varnishtest && ../varnishd/varnishd -d -d -n /tmp/vtc.27004.4c2262bf/v1 -l 10m,1m,- -p auto_restart=off -p syslog_cli_traffic=off -a '127.0.0.1:0' -S /tmp/vtc.27004.4c2262bf/v1/_S -M '127.0.0.1 48915' -P /tmp/vtc.27004.4c2262bf/v1/varnishd.pid -sfile,/tmp/vtc.27004.4c2262bf/v1,10M
*** v1 0.0 PID: 27026
*** v1 0.0 debug| Platform: Linux,3.2.0-2-amd64,x86_64,-sfile,-smalloc,-hcritbit\n
*** v1 0.0 debug| 200 239 \n
*** v1 0.0 debug| -----------------------------\n
*** v1 0.0 debug| Varnish Cache CLI 1.0\n
*** v1 0.0 debug| -----------------------------\n
*** v1 0.0 debug| Linux,3.2.0-2-amd64,x86_64,-sfile,-smalloc,-hcritbit\n
*** v1 0.0 debug| \n
*** v1 0.0 debug| Type 'help' for command list.\n
*** v1 0.0 debug| Type 'quit' to close CLI session.\n
*** v1 0.0 debug| Type 'start' to launch worker process.\n
*** v1 0.0 debug| \n
**** v1 0.1 CLIPOLL 1 0x1 0x0
*** v1 0.1 CLI connection fd = 10
*** v1 0.1 CLI RX 107
**** v1 0.1 CLI RX| jeewhbchriitfqnmdlljphjdymdhvwme\n
**** v1 0.1 CLI RX| \n
**** v1 0.1 CLI RX| Authentication required.\n
**** v1 0.1 CLI TX| auth e11fc5df61935fc9b91e446bc02cbf070862be830d2db4bfe4ae5a6ccfbe0a33\n
*** v1 0.1 CLI RX 200
**** v1 0.1 CLI RX| -----------------------------\n
**** v1 0.1 CLI RX| Varnish Cache CLI 1.0\n
**** v1 0.1 CLI RX| -----------------------------\n
**** v1 0.1 CLI RX| Linux,3.2.0-2-amd64,x86_64,-sfile,-smalloc,-hcritbit\n
**** v1 0.1 CLI RX| \n
**** v1 0.1 CLI RX| Type 'help' for command list.\n
**** v1 0.1 CLI RX| Type 'quit' to close CLI session.\n
**** v1 0.1 CLI RX| Type 'start' to launch worker process.\n
**** v1 0.1 CLI TX| vcl.inline vcl1 << %XJEIFLH|)Xspa8P\n
**** v1 0.1 CLI TX| backend s1 { .host = "127.0.0.1"; .port = "53652"; }\n
**** v1 0.1 CLI TX| backend s2 { .host = "127.0.0.1"; .port = "45207"; }\n
**** v1 0.1 CLI TX| backend s3 { .host = "127.0.0.1"; .port = "35684"; }\n
**** v1 0.1 CLI TX| \n
**** v1 0.1 CLI TX| \n
**** v1 0.1 CLI TX| \tdirector lc least-connection {\n
**** v1 0.1 CLI TX| \t\t{ .backend = s1; .weight = 1; }\n
**** v1 0.1 CLI TX| \t\t{ .backend = s2; .weight = 1; }\n
**** v1 0.1 CLI TX| \t\t{ .backend = s3; .weight = 1; }\n
**** v1 0.1 CLI TX| \t}\n
**** v1 0.1 CLI TX| \tsub vcl_recv {\n
**** v1 0.1 CLI TX| \t\tset req.backend = lc;\n
**** v1 0.1 CLI TX| \t\treturn (pass);\n
**** v1 0.1 CLI TX| \t}\n
**** v1 0.1 CLI TX| \n
**** v1 0.1 CLI TX| %XJEIFLH|)Xspa8P\n
*** v1 0.2 CLI RX 200
**** v1 0.2 CLI RX| VCL compiled.
**** v1 0.2 CLI TX| vcl.use vcl1
*** v1 0.2 CLI RX 200
** v1 0.2 Start
**** v1 0.2 CLI TX| start
*** v1 0.3 debug| child (27052) Started\n
*** v1 0.3 CLI RX 200
*** v1 0.3 wait-running
**** v1 0.3 CLI TX| status
*** v1 0.3 debug| Child (27052) said Not running as root, no priv-sep\n
*** v1 0.3 debug| Child (27052) said Child starts\n
*** v1 0.3 debug| Child (27052) said SMF.s0 mmap'ed 10485760 bytes of 10485760\n
*** v1 0.3 CLI RX 200
**** v1 0.3 CLI RX| Child in state running
**** v1 0.3 CLI TX| debug.xid 1000
*** v1 0.4 CLI RX 200
**** v1 0.4 CLI RX| XID is 1000
**** v1 0.4 CLI TX| debug.listen_address
**** v1 0.4 vsl| 0 CLI - Rd vcl.load "vcl1" ./vcl.qB2JUoQd.so
**** v1 0.4 vsl| 0 CLI - Wr 200 36 Loaded "./vcl.qB2JUoQd.so" as "vcl1"
**** v1 0.4 vsl| 0 CLI - Rd vcl.use "vcl1"
**** v1 0.4 vsl| 0 CLI - Wr 200 0
**** v1 0.4 vsl| 0 CLI - Rd start
**** v1 0.4 vsl| 0 CLI - Wr 200 0
**** v1 0.4 vsl| 0 WorkThread - 0x7f4f53931c70 start
**** v1 0.4 vsl| 0 WorkThread - 0x7f4f53929c70 start
**** v1 0.4 vsl| 0 WorkThread - 0x7f4f53921c70 start
**** v1 0.4 vsl| 0 WorkThread - 0x7f4f5390dc70 start
**** v1 0.4 vsl| 0 WorkThread - 0x7f4f538fdc70 start
**** v1 0.4 vsl| 0 WorkThread - 0x7f4f53905c70 start
**** v1 0.4 vsl| 0 WorkThread - 0x7f4f538f5c70 start
**** v1 0.4 vsl| 0 WorkThread - 0x7f4f538edc70 start
**** v1 0.4 vsl| 0 WorkThread - 0x7f4f538e5c70 start
**** v1 0.4 vsl| 0 WorkThread - 0x7f4f538ddc70 start
**** v1 0.4 vsl| 0 CLI - Rd debug.xid 1000
**** v1 0.4 vsl| 0 CLI - Wr 200 11 XID is 1000
*** v1 0.4 CLI RX 200
**** v1 0.4 CLI RX| 127.0.0.1 37617\n
** v1 0.4 Listen on 127.0.0.1 37617
**** v1 0.4 macro def v1_addr=127.0.0.1
**** v1 0.4 macro def v1_port=37617
**** v1 0.4 macro def v1_sock=127.0.0.1 37617
*** top 0.4 client
** c1 0.4 Starting client
*** top 0.4 client
** c2 0.4 Starting client
*** c1 0.4 Connect to 127.0.0.1 37617
*** top 0.4 delay
*** top 0.4 delaying 0.5 second(s)
*** c2 0.4 Connect to 127.0.0.1 37617
*** c1 0.4 connected fd 15 from 127.0.0.1 50667 to 127.0.0.1 37617
*** c2 0.4 connected fd 14 from 127.0.0.1 50668 to 127.0.0.1 37617
*** c1 0.4 txreq
**** c1 0.4 txreq| GET / HTTP/1.1\r\n
**** c1 0.4 txreq| \r\n
*** c2 0.4 txreq
**** c2 0.4 txreq| GET / HTTP/1.1\r\n
**** c2 0.4 txreq| \r\n
*** c2 0.4 rxresp
*** s1 0.4 accepted fd 5
*** s1 0.4 rxreq
**** s1 0.4 rxhdr| GET / HTTP/1.1\r\n
**** s1 0.4 rxhdr| X-Varnish: 1001\r\n
**** s1 0.4 rxhdr| Host: 127.0.0.1\r\n
**** s1 0.4 rxhdr| \r\n
**** s1 0.4 http[ 0] | GET
**** s1 0.4 http[ 1] | /
**** s1 0.4 http[ 2] | HTTP/1.1
**** s1 0.4 http[ 3] | X-Varnish: 1001
**** s1 0.4 http[ 4] | Host: 127.0.0.1
**** s1 0.4 bodylen = 0
*** s1 0.4 sema
**** s1 0.4 Sema(r1) wait 1 of 3
*** c1 0.4 rxresp
**** v1 0.5 vsl| 0 CLI - Rd debug.listen_address
**** v1 0.5 vsl| 0 CLI - Wr 200 16 127.0.0.1 37617
*** top 0.9 client
** c3 0.9 Starting client
*** top 0.9 client
** c1 0.9 Waiting for client
*** c3 0.9 Connect to 127.0.0.1 37617
*** c3 0.9 connected fd 16 from 127.0.0.1 50671 to 127.0.0.1 37617
*** c3 0.9 txreq
**** c3 0.9 txreq| GET / HTTP/1.1\r\n
**** c3 0.9 txreq| \r\n
*** s2 0.9 accepted fd 7
*** s2 0.9 rxreq
**** s2 0.9 rxhdr| GET / HTTP/1.1\r\n
**** s2 0.9 rxhdr| X-Varnish: 1003\r\n
**** s2 0.9 rxhdr| Host: 127.0.0.1\r\n
**** s2 0.9 rxhdr| \r\n
**** s2 0.9 http[ 0] | GET
**** s2 0.9 http[ 1] | /
**** s2 0.9 http[ 2] | HTTP/1.1
**** s2 0.9 http[ 3] | X-Varnish: 1003
**** s2 0.9 http[ 4] | Host: 127.0.0.1
**** s2 0.9 bodylen = 0
*** s2 0.9 sema
**** s2 0.9 Sema(r1) wait 2 of 3
*** c3 0.9 rxresp
**** v1 3.3 vsl| 0 CLI - Rd ping
**** v1 3.3 vsl| 0 CLI - Wr 200 19 PONG 1333009603 1.0
**** v1 6.3 vsl| 0 CLI - Rd ping
**** v1 6.3 vsl| 0 CLI - Wr 200 19 PONG 1333009606 1.0
**** v1 9.3 vsl| 0 CLI - Rd ping
**** v1 9.3 vsl| 0 CLI - Wr 200 19 PONG 1333009609 1.0
**** v1 12.3 vsl| 0 CLI - Rd ping
**** v1 12.3 vsl| 0 CLI - Wr 200 19 PONG 1333009612 1.0
**** v1 15.4 vsl| 0 CLI - Rd ping
**** v1 15.4 vsl| 0 CLI - Wr 200 19 PONG 1333009615 1.0
---- c2 15.4 HTTP rx timeout (fd:14 15000 ms)
---- c1 15.4 HTTP rx timeout (fd:15 15000 ms)
* top 15.4 RESETTING after tests/v00038.vtc
** s1 15.4 Waiting for server
**** s1 15.4 macro undef s1_addr
**** s1 15.4 macro undef s1_port
**** s1 15.4 macro undef s1_sock
** s2 15.4 Waiting for server
**** v1 15.5 vsl| 17 BereqRequest b GET
**** v1 15.5 vsl| 17 BereqURL b /
**** v1 15.5 vsl| 17 BereqProtocol b HTTP/1.1
**** v1 15.5 vsl| 17 BereqHeader b X-Varnish: 1002
**** v1 15.5 vsl| 17 BereqHeader b Host: 127.0.0.1
**** v1 15.5 vsl| 17 BackendClose b s1(127.0.0.1,,53652)
**** v1 15.5 vsl| 12 SessionOpen c 127.0.0.1 50668 127.0.0.1:0
**** v1 15.5 vsl| 12 ReqStart c 127.0.0.1 50668 1002
**** v1 15.5 vsl| 12 ReqRequest c GET
**** v1 15.5 vsl| 12 ReqURL c /
**** v1 15.5 vsl| 12 ReqProtocol c HTTP/1.1
**** v1 15.5 vsl| 12 VCL_call c recv
**** v1 15.5 vsl| 12 VCL_return c pass
**** v1 15.5 vsl| 12 VCL_call c hash
**** v1 15.5 vsl| 12 Hash c /
**** v1 15.5 vsl| 12 Hash c 127.0.0.1
**** v1 15.5 vsl| 12 VCL_return c hash
**** v1 15.5 vsl| 12 VCL_call c pass
**** v1 15.5 vsl| 12 VCL_return c pass
**** v1 15.5 vsl| 12 BackendOpen c 17 s1(127.0.0.1,,53652) 127.0.0.1 38443
**** v1 15.5 vsl| 12 Backend c 17 lc s1(127.0.0.1,,53652)
**** v1 15.5 vsl| 12 FetchError c http first read error: -1 104 (Connection reset by peer)
**** v1 15.5 vsl| 12 VCL_call c error
**** v1 15.5 vsl| 12 VCL_return c deliver
**** v1 15.5 vsl| 12 VCL_call c deliver
**** v1 15.5 vsl| 12 VCL_return c deliver
**** v1 15.5 vsl| 12 RespProtocol c HTTP/1.1
**** v1 15.5 vsl| 12 RespStatus c 503
**** v1 15.5 vsl| 12 RespResponse c Service Unavailable
**** v1 15.5 vsl| 12 RespHeader c Server: Varnish
**** v1 15.5 vsl| 12 RespHeader c Content-Type: text/html; charset=utf-8
**** v1 15.5 vsl| 12 RespHeader c Retry-After: 5
**** v1 15.5 vsl| 12 RespHeader c Content-Length: 413
**** v1 15.5 vsl| 12 RespHeader c Accept-Ranges: bytes
**** v1 15.5 vsl| 12 RespHeader c Date: Thu, 29 Mar 2012 08:26:55 GMT
**** v1 15.5 vsl| 12 RespHeader c X-Varnish: 1002
**** v1 15.5 vsl| 12 RespHeader c Age: 15
**** v1 15.5 vsl| 12 RespHeader c Via: 1.1 varnish
**** v1 15.5 vsl| 12 RespHeader c Connection: close
**** v1 15.5 vsl| 12 Length c 413
**** v1 15.5 vsl| 12 ReqEnd c 1002 1333009600.319918633 1333009615.336753130 0.000022650 15.016654015 0.000180483
**** v1 15.5 vsl| 12 SessionClose c error
**** v1 15.5 vsl| 12 StatSess c 127.0.0.1 50668 15 1 1 0 1 0 252 413
**** v1 18.4 vsl| 0 CLI - Rd ping
**** v1 18.4 vsl| 0 CLI - Wr 200 19 PONG 1333009618 1.0
**** v1 21.4 vsl| 0 CLI - Rd ping
**** v1 21.4 vsl| 0 CLI - Wr 200 19 PONG 1333009621 1.0
**** v1 24.4 vsl| 0 CLI - Rd ping
**** v1 24.4 vsl| 0 CLI - Wr 200 19 PONG 1333009624 1.0
**** v1 27.4 vsl| 0 CLI - Rd ping
**** v1 27.4 vsl| 0 CLI - Wr 200 19 PONG 1333009627 1.0
**** v1 30.4 vsl| 0 CLI - Rd ping
**** v1 30.4 vsl| 0 CLI - Wr 200 19 PONG 1333009630 1.0
**** v1 33.4 vsl| 0 CLI - Rd ping
**** v1 33.4 vsl| 0 CLI - Wr 200 19 PONG 1333009633 1.0
**** v1 36.4 vsl| 0 CLI - Rd ping
**** v1 36.4 vsl| 0 CLI - Wr 200 19 PONG 1333009636 1.0
**** v1 39.3 vsl| 0 CLI - Rd ping
**** v1 39.3 vsl| 0 CLI - Wr 200 19 PONG 1333009639 1.0
**** v1 42.3 vsl| 0 CLI - Rd ping
**** v1 42.3 vsl| 0 CLI - Wr 200 19 PONG 1333009642 1.0
**** v1 45.3 vsl| 0 CLI - Rd ping
**** v1 45.3 vsl| 0 CLI - Wr 200 19 PONG 1333009645 1.0
**** v1 48.3 vsl| 0 CLI - Rd ping
**** v1 48.3 vsl| 0 CLI - Wr 200 19 PONG 1333009648 1.0
**** v1 51.3 vsl| 0 CLI - Rd ping
**** v1 51.3 vsl| 0 CLI - Wr 200 19 PONG 1333009651 1.0
**** v1 54.3 vsl| 0 CLI - Rd ping
**** v1 54.3 vsl| 0 CLI - Wr 200 19 PONG 1333009654 1.0
**** v1 57.3 vsl| 0 CLI - Rd ping
**** v1 57.3 vsl| 0 CLI - Wr 200 19 PONG 1333009657 1.0
# top TEST tests/v00038.vtc FAILED (60.060) signal=9 exit=0
--
Tollef Fog Heen
Technical lead, Varnish Software
t: +47 21 98 92 64
More information about the varnish-dev
mailing list