<div dir="ltr">Hi,<div style>    I used varnish-cache-3.0.3-plus(get from <a href="https://github.com/mbgrydeland/varnish-cache/tree/3.0.3-plus">https://github.com/mbgrydeland/varnish-cache/tree/3.0.3-plus</a>).</div><div style>
I use persistent storage and "<span style="text-align:justify">set beresp.do_stream = true".<font color="#000000" face="sans-serif" size="3"><span style="line-height:20px"> </span></font></span></div><div style>
The %CPU  is increased from 4% to 800% (8 cpu), and varnish crashed sometimes by errno = 12 (Cannot allocate memory).</div><div style><br></div><div style>my startup command is:</div><div style>/opt/ace/cache/varnish-cache-3.0.3-plus/sbin/varnishd -f /opt/ace/cache/varnish-stream.vcl -s persistent,/opt/ace/file/varnish_cache_persistent.data,12G -T <a href="http://127.0.0.1:2000">127.0.0.1:2000</a> -a <a href="http://0.0.0.0:8080">0.0.0.0:8080</a>  -p thread_pool_min 200 -p thread_pool_max 2000 -p thread_pool_add_delay 2 -p session_linger 100 -p thread_pools 2 -p http_req_hdr_len 32768 -p http_resp_hdr_len 32768 -p http_max_hdr 256 <br>
</div><div style><br></div><div style>Then I change the command  to:</div><div style>/opt/ace/cache/varnish-cache-3.0.3-plus/sbin/varnishd -f /opt/ace/cache/varnish-stream.vcl -s persistent,/opt/ace/file/varnish_cache_persistent.data,12G -T <a href="http://127.0.0.1:2000">127.0.0.1:2000</a> -a <a href="http://0.0.0.0:8080">0.0.0.0:8080</a> <b>-h classic,500009</b> -p thread_pool_min 200 -p thread_pool_max 2000 -p thread_pool_add_delay 2 -p session_linger 100 -p thread_pools 2 -p http_req_hdr_len 32768 -p http_resp_hdr_len 32768 -p http_max_hdr 256 <b>-p lru_interval 3600</b><br>
</div><div style><br></div><div style>The %CPU is increasing too, but varnish hasn't crashed for 16 hours.</div><div style><br></div><div style>Is there somebody has  experience about this problem?  </div><div style>Any advice will be greatly appreciated.</div>
<div style><br></div><div style>Here is the information about system  and varnish.</div><div style><br></div><div style>top:</div><div style><div>top - 09:37:36 up 50 days, 13:06,  3 users,  load average: 5.00, 4.97, 4.73</div>
<div>Tasks: 141 total,   1 running, 140 sleeping,   0 stopped,   0 zombie</div><div>Cpu(s): 62.6%us,  0.0%sy,  0.0%ni, 37.4%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st</div><div>Mem:     20132M total,    19781M used,      351M free,      137M buffers</div>
<div>Swap:     4102M total,        3M used,     4098M free,    18517M cached</div><div><br></div><div>  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+   COMMAND                                                                                                </div>
<div>12255 nobody    20   0 14.7g  11g  11g S  502 59.8   2280:28 varnishd                                                                                                </div><div>30934 acce      20   0  8772 1212  872 R    0  0.0   0:00.02 top  </div>
<div><br></div><div><br></div><div style>free -m:</div></div><div style><div>             total       used       free     shared    buffers     cached</div><div>Mem:         20132      19782        350          0        137      18517</div>
<div>-/+ buffers/cache:       1127      19004</div><div>Swap:         4102          3       4098</div><div><br></div><div><br></div><div><div>ulimit -a:</div><div>core file size          (blocks, -c) 0</div><div>data seg size           (kbytes, -d) unlimited</div>
<div>scheduling priority             (-e) 0</div><div>file size               (blocks, -f) unlimited</div><div>pending signals                 (-i) 156007</div><div>max locked memory       (kbytes, -l) 64</div><div>max memory size         (kbytes, -m) 17523512</div>
<div>open files                      (-n) 65535</div><div>pipe size            (512 bytes, -p) 8</div><div>POSIX message queues     (bytes, -q) 819200</div><div>real-time priority              (-r) 0</div><div>stack size              (kbytes, -s) 4096</div>
<div>cpu time               (seconds, -t) unlimited</div><div>max user processes              (-u) 156007</div><div>virtual memory          (kbytes, -v) 19853520</div><div>file locks                      (-x) unlimited</div>
</div><div><br></div><div style><br></div><div style>varnish panic.show:</div><div style><div>Last panic at: Tue, 14 May 2013 02:56:50 GMT</div><div>Assert error in CNT_Session(), cache_center.c line 1813:</div><div>  Condition((w->do_stream) == 0) not true.</div>
<div>errno = 12 (Cannot allocate memory)</div><div>thread = (cache-worker)</div><div>ident = Linux,2.6.32.59-0.7-xen,x86_64,-spersistent,-smalloc,-hcritbit,epoll</div><div>sp = 0x7f4dcd947008 {</div><div>  fd = 1435, id = 1435, xid = 1304392785,</div>
<div>  client = xx.xx.xx.xx 2396,</div><div>  step = STP_DONE,</div><div>  handling = hit_for_pass,</div><div>  err_code = 502, err_reason = (null),</div><div>  restarts = 0, esi_level = 0</div><div>  flags =  do_stream is_gunzip</div>
<div>  bodystatus = 4</div><div>  ws = 0x7f4dcd947080 { </div><div>    id = "sess",</div><div>    {s,f,r,e} = {0x7f4dcd949610,+344,(nil),+65536},</div><div>  },</div><div>  http[req] = {</div><div>    ws = 0x7f4dcd947080[sess]</div>
<div>      "GET",</div><div>      "<a href="http://www.2xk.cn/index.asp">http://www.2xk.cn/index.asp</a>",</div><div>      "HTTP/1.1",</div><div>      "Accept: */*",</div><div>      "Referer: <a href="http://www.2xk.cn/">http://www.2xk.cn/</a>",</div>
<div>      "Accept-Language: zh-cn",</div><div>      "User-Agent:",</div><div>      "Host: <a href="http://www.2xk.cn">www.2xk.cn</a>",</div><div>      "Proxy-Connection: Keep-Alive",</div>
<div>      "Pragma: no-cache",</div><div>      "X-Forwarded-For: xx.xx.xx.xx",</div><div>      "Accept-Encoding: gzip",</div><div>  },</div><div>  worker = 0x7f4d83a1ca90 {</div><div>    ws = 0x7f4d83a1ccd8 { </div>
<div>      id = "wrk",</div><div>      {s,f,r,e} = {0x7f4d83a0aa20,+616,(nil),+65536},</div><div>    },</div><div>    },</div><div>    vcl = {</div><div>      srcname = {</div><div>        "input",</div>
<div>        "Default",</div><div>      },</div><div>    },</div><div>},</div><div><br></div><div><br></div><div><div>/opt/ace/cache/varnish-cache-3.0.3-plus/bin/varnishstat -1</div><div><div>acce@sz-acce-varnish01:~> /opt/huawei/ace/cache/varnish-cache-3.0.3-plus/bin/varnishstat -1</div>
<div>client_conn            2341640        40.03 Client connections accepted</div><div>client_drop                  8         0.00 Connection dropped, no sess/wrk</div><div>client_req             3031369        51.82 Client requests received</div>
<div>cache_hit               164025         2.80 Cache hits</div><div>cache_hitpass           409263         7.00 Cache hits for pass</div><div>cache_miss             1857720        31.75 Cache misses</div><div>backend_conn            500716         8.56 Backend conn. success</div>
<div>backend_unhealthy            0         0.00 Backend conn. not attempted</div><div>backend_busy                 0         0.00 Backend conn. too many</div><div>backend_fail              8097         0.14 Backend conn. failures</div>
<div>backend_reuse          2375031        40.60 Backend conn. reuses</div><div>backend_toolate          34982         0.60 Backend conn. was closed</div><div>backend_recycle        2410099        41.20 Backend conn. recycles</div>
<div>backend_retry            15375         0.26 Backend conn. retry</div><div>fetch_head                1051         0.02 Fetch head</div><div>fetch_length           2185540        37.36 Fetch with Length</div><div>fetch_chunked           600378        10.26 Fetch chunked</div>
<div>fetch_eof                    0         0.00 Fetch EOF</div><div>fetch_streamed         2792280        47.73 Fetch streamed</div><div>fetch_bad                    0         0.00 Fetch had bad headers</div><div>fetch_close              10117         0.17 Fetch wanted close</div>
<div>fetch_oldhttp                0         0.00 Fetch pre HTTP/1.1 closed</div><div>fetch_zero                   0         0.00 Fetch zero len</div><div>fetch_failed             37332         0.64 Fetch failed</div><div>
fetch_1xx                    0         0.00 Fetch no body (1xx)</div><div>fetch_204                 2720         0.05 Fetch no body (204)</div><div>fetch_304                12112         0.21 Fetch no body (304)</div><div>
n_sess_mem                7231          .   N struct sess_mem</div><div>n_sess                      93          .   N struct sess</div><div>n_object                 86410          .   N struct object</div><div>n_vampireobject              0          .   N unresurrected objects</div>
<div>n_objectcore             86666          .   N struct objectcore</div><div>n_objecthead             51679          .   N struct objecthead</div><div>n_waitinglist            22932          .   N struct waitinglist</div>
<div>n_vbc                       24          .   N struct vbc</div><div>n_wrk                      400          .   N worker threads</div><div>n_wrk_create             14003         0.24 N worker threads created</div><div>
n_wrk_failed              2553         0.04 N worker threads not created</div><div>n_wrk_max                    0         0.00 N worker threads limited</div><div>n_wrk_lqueue                 0         0.00 work request queue length</div>
<div>n_wrk_queued            114487         1.96 N queued work requests</div><div>n_wrk_drop                   8         0.00 N dropped work requests</div><div>n_backend                    4          .   N backends</div><div>
n_expired              1427930          .   N expired objects</div><div>n_lru_nuked              42056          .   N LRU nuked objects</div><div>n_lru_moved                  0          .   N LRU moved objects</div><div>losthdr                    112         0.00 HTTP header overflows</div>
<div>n_objsendfile                0         0.00 Objects sent with sendfile</div><div>n_objwrite              194021         3.32 Objects sent with write</div><div>n_objoverflow                0         0.00 Objects overflowing workspace</div>
<div>s_sess                 2341612        40.03 Total Sessions</div><div>s_req                  3031369        51.82 Total Requests</div><div>s_pipe                    7436         0.13 Total pipe</div><div>s_pass                 1003423        17.15 Total pass</div>
<div>s_fetch                  17926         0.31 Total fetch</div><div>s_stream               2787698        47.65 Total streamed requests</div><div>s_hdrbytes          1048771245     17927.10 Total header bytes</div><div>
s_bodybytes        20286532441    346766.48 Total body bytes</div><div>sess_closed            1781645        30.45 Session Closed</div><div>sess_pipeline            11352         0.19 Session Pipeline</div><div>sess_readahead            7111         0.12 Session Read Ahead</div>
<div>sess_linger            1375398        23.51 Session Linger</div><div>sess_herd               874711        14.95 Session herd</div><div>shm_records          244018270      4171.11 SHM records</div><div>shm_writes            19725032       337.17 SHM writes</div>
<div>shm_flushes               3325         0.06 SHM flushes due to overflow</div><div>shm_cont                 33597         0.57 SHM MTX contention</div><div>shm_cycles                 104         0.00 SHM cycles through buffer</div>
<div>sms_nreq                 49339         0.84 SMS allocator requests</div><div>sms_nobj                     0          .   SMS outstanding allocations</div><div>sms_nbytes                   0          .   SMS outstanding bytes</div>
<div>sms_balloc            23339027          .   SMS bytes allocated</div><div>sms_bfree             23339027          .   SMS bytes freed</div><div>backend_req            2867335        49.01 Backend requests made</div><div>
n_vcl                        1         0.00 N vcl total</div><div>n_vcl_avail                  1         0.00 N vcl available</div><div>n_vcl_discard                0         0.00 N vcl discarded</div><div>n_ban                        1          .   N total active bans</div>
<div>n_ban_gone                   1          .   N total gone bans</div><div>n_ban_add                    6         0.00 N new bans added</div><div>n_ban_retire                 5         0.00 N old bans deleted</div><div>
n_ban_obj_test           23688         0.40 N objects tested</div><div>n_ban_re_test                0         0.00 N regexps tested against</div><div>n_ban_dups                   5         0.00 N duplicate bans removed</div>
<div>hcb_nolock                   0         0.00 HCB Lookups without lock</div><div>hcb_lock                     0         0.00 HCB Lookups with lock</div><div>hcb_insert                   0         0.00 HCB Inserts</div>
<div>esi_errors                   0         0.00 ESI parse errors (unlock)</div><div>esi_warnings                 0         0.00 ESI parse warnings (unlock)</div><div>accept_fail                  0         0.00 Accept failures</div>
<div>client_drop_late             0         0.00 Connection dropped late</div><div>uptime                   58502         1.00 Client uptime</div><div>dir_dns_lookups              0         0.00 DNS director lookups</div>
<div>dir_dns_failed               0         0.00 DNS director failed lookups</div><div>dir_dns_hit                  0         0.00 DNS director cached lookups hit</div><div>dir_dns_cache_full           0         0.00 DNS director full dnscache</div>
<div>vmods                        0          .   Loaded VMODs</div><div>n_gzip                       0         0.00 Gzip operations</div><div>n_gunzip               1266712        21.65 Gunzip operations</div><div>LCK.sms.creat                1         0.00 Created locks</div>
<div>LCK.sms.destroy              0         0.00 Destroyed locks</div><div>LCK.sms.locks           148017         2.53 Lock Operations</div><div>LCK.sms.colls                0         0.00 Collisions</div><div>LCK.smp.creat                1         0.00 Created locks</div>
<div>LCK.smp.destroy              0         0.00 Destroyed locks</div><div>LCK.smp.locks         10868618       185.78 Lock Operations</div><div>LCK.smp.colls                0         0.00 Collisions</div><div>LCK.sma.creat                1         0.00 Created locks</div>
<div>LCK.sma.destroy              0         0.00 Destroyed locks</div><div>LCK.sma.locks          4945521        84.54 Lock Operations</div><div>LCK.sma.colls                0         0.00 Collisions</div><div>LCK.smf.creat                0         0.00 Created locks</div>
<div>LCK.smf.destroy              0         0.00 Destroyed locks</div><div>LCK.smf.locks                0         0.00 Lock Operations</div><div>LCK.smf.colls                0         0.00 Collisions</div><div>LCK.hsl.creat                0         0.00 Created locks</div>
<div>LCK.hsl.destroy              0         0.00 Destroyed locks</div><div>LCK.hsl.locks                0         0.00 Lock Operations</div><div>LCK.hsl.colls                0         0.00 Collisions</div><div>LCK.hcb.creat                0         0.00 Created locks</div>
<div>LCK.hcb.destroy              0         0.00 Destroyed locks</div><div>LCK.hcb.locks                0         0.00 Lock Operations</div><div>LCK.hcb.colls                0         0.00 Collisions</div><div>LCK.hcl.creat           500009         8.55 Created locks</div>
<div>LCK.hcl.destroy              0         0.00 Destroyed locks</div><div>LCK.hcl.locks          4918023        84.07 Lock Operations</div><div>LCK.hcl.colls                0         0.00 Collisions</div><div>LCK.vcl.creat                1         0.00 Created locks</div>
<div>LCK.vcl.destroy              0         0.00 Destroyed locks</div><div>LCK.vcl.locks          2573092        43.98 Lock Operations</div><div>LCK.vcl.colls                0         0.00 Collisions</div><div>LCK.stat.creat               1         0.00 Created locks</div>
<div>LCK.stat.destroy             0         0.00 Destroyed locks</div><div>LCK.stat.locks         7933355       135.61 Lock Operations</div><div>LCK.stat.colls               0         0.00 Collisions</div><div>LCK.sessmem.creat            1         0.00 Created locks</div>
<div>LCK.sessmem.destroy            0         0.00 Destroyed locks</div><div>LCK.sessmem.locks        7932823       135.60 Lock Operations</div><div>LCK.sessmem.colls              0         0.00 Collisions</div><div>LCK.wstat.creat                1         0.00 Created locks</div>
<div>LCK.wstat.destroy              0         0.00 Destroyed locks</div><div>LCK.wstat.locks           142801         2.44 Lock Operations</div><div>LCK.wstat.colls                0         0.00 Collisions</div><div>LCK.herder.creat               1         0.00 Created locks</div>
<div>LCK.herder.destroy             0         0.00 Destroyed locks</div><div>LCK.herder.locks            4032         0.07 Lock Operations</div><div>LCK.herder.colls               0         0.00 Collisions</div><div>LCK.wq.creat                   2         0.00 Created locks</div>
<div>LCK.wq.destroy                 0         0.00 Destroyed locks</div><div>LCK.wq.locks            11199698       191.44 Lock Operations</div><div>LCK.wq.colls                   0         0.00 Collisions</div><div>LCK.objhdr.creat          800591        13.68 Created locks</div>
<div>LCK.objhdr.destroy        748913        12.80 Destroyed locks</div><div>LCK.objhdr.locks        15295089       261.45 Lock Operations</div><div>LCK.objhdr.colls               0         0.00 Collisions</div><div>LCK.exp.creat                  1         0.00 Created locks</div>
<div>LCK.exp.destroy                0         0.00 Destroyed locks</div><div>LCK.exp.locks            3544111        60.58 Lock Operations</div><div>LCK.exp.colls                  0         0.00 Collisions</div><div>LCK.lru.creat               9854         0.17 Created locks</div>
<div>LCK.lru.destroy             8840         0.15 Destroyed locks</div><div>LCK.lru.locks            2066424        35.32 Lock Operations</div><div>LCK.lru.colls                  0         0.00 Collisions</div><div>LCK.cli.creat                  1         0.00 Created locks</div>
<div>LCK.cli.destroy                0         0.00 Destroyed locks</div><div>LCK.cli.locks              19486         0.33 Lock Operations</div><div>LCK.cli.colls                  0         0.00 Collisions</div><div>LCK.ban.creat                  1         0.00 Created locks</div>
<div>LCK.ban.destroy                0         0.00 Destroyed locks</div><div>LCK.ban.locks            3842809        65.69 Lock Operations</div><div>LCK.ban.colls                  0         0.00 Collisions</div><div>LCK.vbp.creat                  1         0.00 Created locks</div>
<div>LCK.vbp.destroy                0         0.00 Destroyed locks</div><div>LCK.vbp.locks               7808         0.13 Lock Operations</div><div>LCK.vbp.colls                  0         0.00 Collisions</div><div>LCK.vbe.creat                  1         0.00 Created locks</div>
<div>LCK.vbe.destroy                0         0.00 Destroyed locks</div><div>LCK.vbe.locks            1017738        17.40 Lock Operations</div><div>LCK.vbe.colls                  0         0.00 Collisions</div><div>LCK.backend.creat              4         0.00 Created locks</div>
<div>LCK.backend.destroy            0         0.00 Destroyed locks</div><div>LCK.backend.locks        6346813       108.49 Lock Operations</div><div>LCK.backend.colls              0         0.00 Collisions</div><div>LCK.busyobj.creat          13983         0.24 Created locks</div>
<div>LCK.busyobj.destroy        13582         0.23 Destroyed locks</div><div>LCK.busyobj.locks       47081281       804.78 Lock Operations</div><div>LCK.busyobj.colls              0         0.00 Collisions</div><div>SMP.s0.c_req             3025767          .   Allocater requests</div>
<div>SMP.s0.c_fail                352          .   Allocater failures</div><div>SMP.s0.c_bytes      115414281600          .   Bytes allocated</div><div>SMP.s0.c_freed      110868836208          .   Bytes freed</div><div>SMP.s0.g_alloc            158780          .   Allocations outstanding</div>
<div>SMP.s0.g_bytes        4545445392          .   Bytes outstanding</div><div>SMP.s0.g_free          138490880          .   Free space</div><div>SMP.s0.g_free_pending            0          .   Free space pending</div><div>
SMP.s0.g_segments             1012          .   In use segments</div><div>SMP.s0.c_segments_nuked         8506          .   Number of nuked segments</div><div>SMP.s0.g_vampireobjects            0          .   Vampire objects</div>
<div>SMP.s0.c_resurrection_fail           46          .   Failed resurrections</div><div>SMA.Transient.c_req             2271927        38.84 Allocator requests</div><div>SMA.Transient.c_fail                  0         0.00 Allocator failures</div>
<div>SMA.Transient.c_bytes       59014304554   1008757.04 Bytes allocated</div><div>SMA.Transient.c_freed       58939691205   1007481.65 Bytes freed</div><div>SMA.Transient.g_alloc             18069          .   Allocations outstanding</div>
<div>SMA.Transient.g_bytes          74613349          .   Bytes outstanding</div><div>SMA.Transient.g_space                 0          .   Bytes available</div><div>VBE.proxy1(10.21.34.21,,8080).vcls            1          .   VCL references</div>
<div>VBE.proxy1(10.21.34.21,,8080).happy18446744073709551615          .   Happy health probes</div><div>VBE.proxy2(10.21.34.22,,8080).vcls            1          .   VCL references</div><div>VBE.proxy2(10.21.34.22,,8080).happy18446744056529682431          .   Happy health probes</div>
<div>VBE.proxy3(10.21.34.23,,8082).vcls            1          .   VCL references</div><div>VBE.proxy3(10.21.34.23,,8082).happy18446744073709551615          .   Happy health probes</div><div>VBE.proxy4(10.21.34.24,,8081).vcls            1          .   VCL references</div>
<div>VBE.proxy4(10.21.34.24,,8081).happy18446744073709551615          .   Happy health probes</div></div></div><div><br></div><div><br></div></div><div style>varnish-stream.vcl:<br></div><div style><div>acce@sz-acce-varnish01:~> cat /opt/huawei/ace/cache/varnish-stream.vcl</div>
<div># This is a basic VCL configuration file for varnish.  See the vcl(7)</div><div># man page for details on VCL syntax and semantics.</div><div>#</div><div># Default backend definition.  Set this to point to your content</div>
<div># server.</div><div>#</div><div><br></div><div>probe healthcheck {</div><div>   .url = "/";</div><div>   .interval = 30s;</div><div>   .timeout = 0.5s;</div><div>   .window = 8;</div><div>   .threshold = 3;</div>
<div>   .initial = 3;</div><div>}</div><div><br></div><div>backend proxy1 {</div><div>     .host = "10.21.34.21";</div><div>     .port = "8080";</div><div>     .probe = healthcheck;</div><div>}</div><div>
<br></div><div>backend proxy2 {</div><div>     .host = "10.21.34.22";</div><div>     .port = "8080";</div><div>     .probe = healthcheck;</div><div>}</div><div><br></div><div>backend proxy3 {</div><div>
     .host = "10.21.34.23";</div><div>     .port = "8082";</div><div>     .probe = healthcheck;</div><div>}</div><div><br></div><div>backend proxy4 {</div><div>     .host = "10.21.34.24";</div>
<div>     .port = "8081";</div><div>     .probe = healthcheck;</div><div>}</div><div><br></div><div>director proxy client {</div><div>   {</div><div>      .backend = proxy1;</div><div>      .weight = 1;</div><div>
   }</div><div>   {</div><div>      .backend = proxy2;</div><div>      .weight = 1;</div><div>   }</div><div>#   {</div><div>#      .backend = proxy3;</div><div>#      .weight = 1;</div><div>#   }</div><div>#   {</div><div>
#      .backend = proxy4;</div><div>#<span class="" style="white-space:pre">      </span>  .weight = 1;</div><div>#   }</div><div>}</div><div><br></div><div><br></div><div>acl refresh {</div><div>        "10.21.34.31";</div>
<div>}</div><div><br></div><div><br></div><div># Below is a commented-out copy of the default VCL logic.  If you</div><div># redefine any of these subroutines, the built-in logic will be</div><div># appended to your code.</div>
<div> sub vcl_recv {</div><div>   </div><div>    if(req.http.X-Real-IP){</div><div>          set client.identity = req.http.X-Real-IP;</div><div>    }else if (req.http.referer) {</div><div>          set client.identity = req.http.referer;</div>
<div>    }else{</div><div>          set client.identity = req.url;</div><div>    }</div><div><span class="" style="white-space:pre">        </span></div><div>#<span class="" style="white-space:pre">  </span> set req.backend = proxy;</div>
<div><span class="" style="white-space:pre">    </span></div><div>     if (client.ip == "10.21.34.11" || client.ip == "10.21.34.12"){</div><div>        </div><div>        if (req.http.X-SZ-TEST && req.http.X-SZ-TEST == "1"){</div>
<div>            set req.backend = proxy3;</div><div>        } else {</div><div>            set req.backend = proxy;</div><div>        }</div><div><br></div><div>     } else {</div><div>       set req.backend = proxy4;</div>
<div>       if (client.ip ~ refresh) {            </div><div>             set req.hash_always_miss = true;          </div><div>       } </div><div>    }   </div><div>    </div><div>    #set grace</div><div>    if (req.backend.healthy) {</div>
<div>      set req.grace = 30s;</div><div>    } else {</div><div>      set req.grace = 30m;</div><div>    }</div><div><br></div><div>    if (req.restarts == 0) {</div><div>        if (req.http.x-forwarded-for) {</div><div>
            set req.http.X-Forwarded-For =</div><div>                req.http.X-Forwarded-For + ", " + client.ip;</div><div>        } else {</div><div>            set req.http.X-Forwarded-For = client.ip;</div><div>
        }</div><div>}</div><div>     if (req.request != "GET" &&</div><div>       req.request != "HEAD" &&</div><div>       req.request != "PUT" &&</div><div>       req.request != "POST" &&</div>
<div>       req.request != "TRACE" &&</div><div>       req.request != "OPTIONS" &&</div><div>       req.request != "DELETE") {</div><div>#         /* Non-RFC2616 or CONNECT which is weird. */</div>
<div>         return (pipe);</div><div>     }</div><div><br></div><div>     if (req.http.x-pipe && req.restarts > 0) {</div><div>         remove req.http.x-pipe;</div><div>         return (pipe);</div><div>    }</div>
<div><br></div><div>     if(req.request != "GET" && req.request != "HEAD") {</div><div>#         /* We only deal with GET and HEAD by default */</div><div>         return (pass);</div><div>     }</div>
<div>     </div><div>    if (req.http.Cache-Control ~ "no-cache") {</div><div>     return (pass);</div><div>     }</div><div><br></div><div>     if (req.http.Accept-Encoding) {</div><div>        if (req.url ~ "\.(webp|jpeg|png|mid|mp3|gif|sql|jpg|nth|thm|utz|mtf|sdt|hme|tsk|zip|rar|sx|pxl|cab|mbm|app|exe|apk)$") {            </div>
<div>            # No point in compressing these</div><div>            remove req.http.Accept-Encoding;</div><div>        } elsif (req.http.Accept-Encoding ~ "gzip") {</div><div>            set req.http.Accept-Encoding = "gzip";</div>
<div>        } elsif (req.http.Accept-Encoding ~ "deflate") {</div><div>            set req.http.Accept-Encoding = "deflate";</div><div>        } else {</div><div>            # unknown algorithm</div><div>
            remove req.http.Accept-Encoding;</div><div>        }</div><div>    }</div><div><br></div><div><br></div><div>#    if (req.request == "GET" &&</div><div>#       req.url ~ "\.(webp|jpeg|png|mid|mp3|gif|sql|jpg|nth|thm|utz|mtf|sdt|hme|tsk|zip|rar|sx|pxl|cab|mbm|app|exe|apk)$"){</div>
<div>#         unset req.http.Cookie;</div><div>#          return (lookup);</div><div>#     }</div><div>     </div><div>#     if (req.http.Authorization || req.http.Cookie) {</div><div>#     return (pass);</div><div>#     }</div>
<div><br></div><div>     if (req.http.Authorization) {</div><div>         return (pass);</div><div>     }</div><div><br></div><div>     return (lookup);</div><div> }</div><div><br></div><div> sub vcl_pipe {</div><div>#     # Note that only the first request to the backend will have</div>
<div>#     # X-Forwarded-For set.  If you use X-Forwarded-For and want to</div><div>#     # have it set for all requests, make sure to have:</div><div>        set bereq.http.connection = "close";</div><div>#     # here.  It is not set by default as it might break some broken web</div>
<div>#     # applications, like IIS with NTLM authentication.</div><div>     return (pipe);</div><div> }</div><div><br></div><div> sub vcl_pass {</div><div> </div><div>     return (pass);</div><div> }</div><div><br></div>
<div> sub vcl_hash {</div><div><br></div><div>   if (req.url ~ ".(jpeg|jpg|png|gif|ico|js|css)\?.*") {</div><div>       hash_data(regsub(req.url, "\?[^\?]*$", ""));</div><div>     } else{</div>
<div>      hash_data(req.url);</div><div>    }</div><div><br></div><div>#     hash_data(req.url);</div><div><br></div><div>     if (req.http.host) {</div><div>         hash_data(req.http.host);</div><div>     } else {</div>
<div>         hash_data(server.ip);</div><div>     }</div><div>     return (hash);</div><div> }</div><div><br></div><div> sub vcl_hit {</div><div><br></div><div>     return (deliver);</div><div> }</div><div><br></div><div>
 sub vcl_miss {</div><div> </div><div>     return (fetch);</div><div> }</div><div><br></div><div><br></div><div> sub vcl_fetch {</div><div>    set beresp.grace = 30m;</div><div><br></div><div>    set beresp.do_stream = true;  </div>
<div>    </div><div>    if (beresp.http.Content-Length && beresp.http.Content-Length ~ "[0-9]{8,}") {</div><div>        set req.http.x-pipe = "1";</div><div>        return (restart);</div><div>
    }</div><div><br></div><div>    if (beresp.http.Pragma ~ "no-cache" || beresp.http.Cache-Control ~ "no-cache" || beresp.http.Cache-Control ~ "private"){</div><div>         return (hit_for_pass);</div>
<div>       }</div><div><br></div><div>     if (beresp.ttl <= 0s ||</div><div>         beresp.http.Set-Cookie ||</div><div>         beresp.http.Vary == "*") {</div><div><br></div><div>            set beresp.ttl = 120 s;</div>
<div>            return (hit_for_pass);</div><div>     }</div><div>    </div><div>    if(beresp.status >=300 && beresp.status <= 307){</div><div>       set beresp.ttl = 120 s;</div><div>       return (hit_for_pass);</div>
<div>     }</div><div><br></div><div>     return (deliver);</div><div> }</div><div><br></div><div>sub vcl_deliver {</div><div>    if (obj.hits > 0) {</div><div>       set resp.http.X-Cache = "HIT from varnis";</div>
<div>       set resp.http.X-Hits = obj.hits;</div><div>    } else {</div><div>      set resp.http.X-Cache = "MISS from varnish";</div><div>    }</div><div><span class="" style="white-space:pre">    </span></div><div>
    remove resp.http.Via;</div><div>    remove resp.http.X-Varnish;</div><div>    </div><div>    return (deliver);</div><div>}</div><div><br></div><div> sub vcl_error {</div><div>     set obj.http.Content-Type = "text/html; charset=utf-8";</div>
<div>     set obj.http.Retry-After = "5";</div><div>     synthetic {"</div><div> <?xml version="1.0" encoding="utf-8"?></div><div> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"</div>
<div>  "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>"></div><div> <html></div><div>   <head></div><div>     <title>"} + obj.status + " " + obj.response + {"</title></div>
<div>   </head></div><div>   <body></div><div>     <h1>Error "} + obj.status + " " + obj.response + {"</h1></div><div>     <p>"} + obj.response + {"</p></div>
<div>     <h3>Guru Meditation:</h3></div><div>     <p>XID: "} + req.xid + {"</p></div><div>     <hr></div><div>     <p>Varnish cache server</p></div><div>     <p>varnish</p></div>
<div>   </body></div><div> </html></div><div> "};</div><div>     return (deliver);</div><div> }</div><div><br></div><div> sub vcl_init {</div><div>        return (ok);</div><div> }</div><div><br></div><div>
 sub vcl_fini {</div><div>        return (ok);</div><div>}</div><div><br></div><div><br></div><div style>varnish param.show</div><div style><div>param.show</div><div>200        </div><div>acceptor_sleep_decay        0.900000 []</div>
<div>acceptor_sleep_incr         0.001000 [s]</div><div>acceptor_sleep_max          0.050000 [s]</div><div>auto_restart                on [bool]</div><div>ban_dups                    on [bool]</div><div>ban_lurker_sleep            0.010000 [s]</div>
<div>between_bytes_timeout       60.000000 [s]</div><div>cc_command                  "exec gcc -std=gnu99  -pthread -fpic -shared -Wl,-x -o %o %s"</div><div>cli_buffer                  8192 [bytes]</div><div>cli_timeout                 10 [seconds]</div>
<div>clock_skew                  10 [s]</div><div>connect_timeout             0.700000 [s]</div><div>critbit_cooloff             180.000000 [s]</div><div>default_grace               10.000000 [seconds]</div><div>default_keep                0.000000 [seconds]</div>
<div>default_ttl                 120.000000 [seconds]</div><div>diag_bitmap                 0x0 [bitmap]</div><div>esi_syntax                  0 [bitmap]</div><div>expiry_sleep                1.000000 [seconds]</div><div>
fetch_chunksize             128 [kilobytes]</div><div>fetch_maxchunksize          262144 [kilobytes]</div><div>first_byte_timeout          60.000000 [s]</div><div>group                       nobody (65533)</div><div>gzip_level                  6 []</div>
<div>gzip_memlevel               8 []</div><div>gzip_stack_buffer           32768 [Bytes]</div><div>gzip_tmp_space              0 []</div><div>gzip_window                 15 []</div><div>http_gzip_support           on [bool]</div>
<div>http_max_hdr                256 [header lines]</div><div>http_range_support          on [bool]</div><div>http_req_hdr_len            32768 [bytes]</div><div>http_req_size               32768 [bytes]</div><div>http_resp_hdr_len           32768 [bytes]</div>
<div>http_resp_size              32768 [bytes]</div><div>idle_send_timeout           60 [seconds]</div><div>listen_address              <a href="http://0.0.0.0:8080">0.0.0.0:8080</a></div><div>listen_depth                1024 [connections]</div>
<div>log_hashstring              on [bool]</div><div>log_local_address           off [bool]</div><div>lru_interval                3600 [seconds]</div><div>max_esi_depth               5 [levels]</div><div>max_restarts                4 [restarts]</div>
<div>nuke_limit                  50 [allocations]</div><div>pcre_match_limit            10000 []</div><div>pcre_match_limit_recursion  10000 []</div><div>ping_interval               3 [seconds]</div><div>pipe_timeout                60 [seconds]</div>
<div>prefer_ipv6                 off [bool]</div><div>queue_max                   100 [%]</div><div>rush_exponent               3 [requests per request]</div><div>saintmode_threshold         10 [objects]</div><div>send_timeout                600 [seconds]</div>
<div>sess_timeout                5 [seconds]</div><div>sess_workspace              65536 [bytes]</div><div>session_linger              100 [ms]</div><div>session_max                 100000 [sessions]</div><div>shm_reclen                  255 [bytes]</div>
<div>shm_workspace               8192 [bytes]</div><div>shortlived                  10.000000 [s]</div><div>stream_maxchunksize         256 [kilobytes]</div><div>stream_tokens               10 []</div><div>syslog_cli_traffic          on [bool]</div>
<div>thread_pool_add_delay       2 [milliseconds]</div><div>thread_pool_add_threshold   0 [requests]</div><div>thread_pool_fail_delay      200 [milliseconds]</div><div>thread_pool_max             2000 [threads]</div><div>
thread_pool_min             200 [threads]</div><div>thread_pool_purge_delay     1000 [milliseconds]</div><div>thread_pool_stack           unlimited [bytes]</div><div>thread_pool_timeout         300 [seconds]</div><div>thread_pool_workspace       65536 [bytes]</div>
<div>thread_pools                2 [pools]</div><div>thread_stats_rate           10 [requests]</div><div>user                        nobody (65534)</div><div>vcc_err_unref               on [bool]</div><div>vcl_dir                     /opt//ace/cache/varnish-cache-3.0.3-plus/etc/varnish</div>
<div>vcl_trace                   off [bool]</div><div>vmod_dir                    /opt/ace/cache/varnish-cache-3.0.3-plus/lib/varnish/vmods</div><div>waiter                      default (epoll, poll)</div><div><br></div><div>
<br></div><div style>Thank you again.</div><div style><br></div><div style>Regards,</div><div style>Shawn</div></div></div></div></div>