<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello all, First sorry for the long email.<br>
      I have a strange issue with varnish. At least I think it is
      strange.</p>
    <p>We start some tests with varnish, but we have an issue.<br>
      <br>
      I am running varnish 4.1.6 on FreeBSD 11.1-prerelease. Where
      varnish listen on port 82 and apache on 80, This is just for the
      tests.<br>
      We use the following start options.<br>
      <br>
      # Varnish<br>
      varnishd_enable="YES"<br>
      varnishd_listen="192.168.2.247:82"<br>
      varnishd_pidfile="/var/run/varnishd.pid"<br>
      varnishd_storage="default=malloc,2024M"<br>
      varnishd_config="/usr/local/etc/varnish/default.vcl"<br>
      varnishd_hash="critbit"<br>
      varnishd_admin=":6082"<br>
      varnishncsa_enable="YES"<br>
      <br>
      We did a test with a static page and that went fine. First we see
      it is not cached, second attempt is cached.<br>
    </p>
    <p>root@desk:~ # curl -I <a class="moz-txt-link-abbreviated" href="http://www.testdomain.nl:82/info.html">www.testdomain.nl:82/info.html</a><br>
      HTTP/1.1 200 OK<br>
      Date: Fri, 02 Jun 2017 09:19:52 GMT<br>
      Last-Modified: Thu, 01 Jun 2017 12:50:37 GMT<br>
      ETag: "cf4-550e57bc1f812"<br>
      Content-Length: 3316<br>
      Content-Type: text/html<br>
      cache-control: max-age = 259200<br>
      X-Varnish: 2<br>
      Age: 0<br>
      Via: 1.1 varnish-v4<br>
      Server: varnish<br>
      X-Powered-By: My Varnish<br>
      X-Cache: MISS<br>
      Accept-Ranges: bytes<br>
      Connection: keep-alive<br>
      <br>
      root@desk:~ # curl -I <a class="moz-txt-link-abbreviated" href="http://www.testdomain.nl:82/info.html">www.testdomain.nl:82/info.html</a><br>
      HTTP/1.1 200 OK<br>
      Date: Fri, 02 Jun 2017 09:19:52 GMT<br>
      Last-Modified: Thu, 01 Jun 2017 12:50:37 GMT<br>
      ETag: "cf4-550e57bc1f812"<br>
      Content-Length: 3316<br>
      Content-Type: text/html<br>
      cache-control: max-age = 259200<br>
      X-Varnish: 5 3<br>
      Age: 6<br>
      Via: 1.1 varnish-v4<br>
      Server: varnish<br>
      X-Powered-By: My Varnish<br>
      X-Cache: HIT<br>
      Accept-Ranges: bytes<br>
      Connection: keep-alive<br>
      <br>
      if I benchmark the server I get the following.<br>
      First is derectly to Apache<br>
    </p>
    <p>root@testserver:~ # bombardier -c400 -n10000
      <a class="moz-txt-link-freetext" href="http://www.testdomain.nl/info.html">http://www.testdomain.nl/info.html</a><br>
      Bombarding <a class="moz-txt-link-freetext" href="http://www.testdomain.nl/info.html">http://www.testdomain.nl/info.html</a> with 10000 requests
      using 400 connections<br>
       10000 / 10000
      [=============================================================]
      100.00% 0s<br>
      Done!<br>
      Statistics        Avg      Stdev        Max<br>
        Reqs/sec     12459.00     898.32      13301<br>
        Latency       31.04ms    25.28ms   280.90ms<br>
        HTTP codes:<br>
          1xx - 0, 2xx - 10000, 3xx - 0, 4xx - 0, 5xx - 0<br>
          others - 0<br>
        Throughput:    42.16MB/s<br>
      <br>
      This is via varnish. So that works as intended.<br>
      Varnish does its job and servers the page better.<br>
    </p>
    <p>root@testserver:~ # bombardier -c400 -n10000
      <a class="moz-txt-link-freetext" href="http://www.testdomain.nl:82/info.html">http://www.testdomain.nl:82/info.html</a><br>
      Bombarding <a class="moz-txt-link-freetext" href="http://www.testdomain.nl:82/info.html">http://www.testdomain.nl:82/info.html</a> with 10000
      requests using 400 connections<br>
       10000 / 10000
      [=============================================================]
      100.00% 0s<br>
      Done!<br>
      Statistics        Avg      Stdev        Max<br>
        Reqs/sec     19549.00    7649.32      24313<br>
        Latency       17.90ms    66.77ms   485.07ms<br>
        HTTP codes:<br>
          1xx - 0, 2xx - 10000, 3xx - 0, 4xx - 0, 5xx - 0<br>
          others - 0<br>
        Throughput:    71.58MB/s<br>
      <br>
      <br>
      The next one is against a info.php file, which runs phpinfo(); <br>
      <br>
      So first agains the server without varnish.<br>
    </p>
    <p>root@testserver:~ # bombardier -c400 -n10000
      <a class="moz-txt-link-freetext" href="http://www.testdomain.nl/info.php">http://www.testdomain.nl/info.php</a><br>
      Bombarding <a class="moz-txt-link-freetext" href="http://www.testdomain.nl/info.php">http://www.testdomain.nl/info.php</a> with 10000 requests
      using 400 connections<br>
       10000 / 10000
      [============================================================]
      100.00% 11s<br>
      Done!<br>
      Statistics        Avg      Stdev        Max<br>
        Reqs/sec       828.00     127.66       1010<br>
        Latency      472.10ms    59.10ms   740.43ms<br>
        HTTP codes:<br>
          1xx - 0, 2xx - 10000, 3xx - 0, 4xx - 0, 5xx - 0<br>
          others - 0<br>
        Throughput:    75.51MB/s<br>
      <br>
      But then against the server with varnish.<br>
      So we make sure it is in cache <br>
    </p>
    <p>root@desk:~ # curl -I <a class="moz-txt-link-abbreviated" href="http://www.testdomain.nl:82/info.php">www.testdomain.nl:82/info.php</a><br>
      HTTP/1.1 200 OK<br>
      Date: Fri, 02 Jun 2017 09:36:16 GMT<br>
      Content-Type: text/html; charset=UTF-8<br>
      cache-control: max-age = 259200<br>
      X-Varnish: 7<br>
      Age: 0<br>
      Via: 1.1 varnish-v4<br>
      Server: varnish<br>
      X-Powered-By: My Varnish<br>
      X-Cache: MISS<br>
      Accept-Ranges: bytes<br>
      Connection: keep-alive<br>
      <br>
      root@desk:~ # curl -I <a class="moz-txt-link-abbreviated" href="http://www.testdomain.nl:82/info.php">www.testdomain.nl:82/info.php</a><br>
      HTTP/1.1 200 OK<br>
      Date: Fri, 02 Jun 2017 09:36:16 GMT<br>
      Content-Type: text/html; charset=UTF-8<br>
      cache-control: max-age = 259200<br>
      X-Varnish: 10 8<br>
      Age: 2<br>
      Via: 1.1 varnish-v4<br>
      Server: varnish<br>
      X-Powered-By: My Varnish<br>
      X-Cache: HIT<br>
      Accept-Ranges: bytes<br>
      Connection: keep-alive<br>
      <br>
      So it is in cache now.<br>
      root@testserver:~ # bombardier -c400 -n10000
      <a class="moz-txt-link-freetext" href="http://www.testdomain.nl:82/info.php">http://www.testdomain.nl:82/info.php</a><br>
      Bombarding <a class="moz-txt-link-freetext" href="http://www.testdomain.nl:82/info.php">http://www.testdomain.nl:82/info.php</a> with 10000
      requests using 400 connections<br>
       10000 / 10000
[===========================================================================================================================================================================================================]
      100.00% 8s<br>
      Done!<br>
      Statistics        Avg      Stdev        Max<br>
        Reqs/sec      1179.00     230.77       1981<br>
        Latency      219.94ms   340.29ms      2.00s<br>
        HTTP codes:<br>
          1xx - 0, 2xx - 9938, 3xx - 0, 4xx - 0, 5xx - 0<br>
          others - 62<br>
        Errors:<br>
          dialing to the given TCP address timed out - 62<br>
        Throughput:    83.16MB/s<br>
    </p>
    <p>I expected this to be much more in favour of varnish, but it even
      generated some errors! Time taken is lower but I expected it to be
      much faster. Also the 62 errors is not good i guess.<br>
      <br>
      I do see the following with varnish log<br>
      *   << Request  >> 11141123<br>
      -   Begin          req 1310723 rxreq<br>
      -   Timestamp      Start: 1496396250.098654 0.000000 0.000000<br>
      -   Timestamp      Req: 1496396250.098654 0.000000 0.000000<br>
      -   ReqStart       192.168.2.39 14818<br>
      -   ReqMethod      GET<br>
      -   ReqURL         /info.php<br>
      -   ReqProtocol    HTTP/1.1<br>
      -   ReqHeader      User-Agent: fasthttp<br>
      -   ReqHeader      Host: <a class="moz-txt-link-abbreviated" href="http://www.testdomain.nl:82">www.testdomain.nl:82</a><br>
      -   ReqHeader      X-Forwarded-For: 192.168.2.39<br>
      -   VCL_call       RECV<br>
      -   ReqUnset       X-Forwarded-For: 192.168.2.39<br>
      -   ReqHeader      X-Forwarded-For: 192.168.2.39, 192.168.2.39<br>
      -   VCL_return     hash<br>
      -   VCL_call       HASH<br>
      -   VCL_return     lookup<br>
      -   Hit            8<br>
      -   VCL_call       HIT<br>
      -   VCL_return     deliver<br>
      -   RespProtocol   HTTP/1.1<br>
      -   RespStatus     200<br>
      -   RespReason     OK<br>
      -   RespHeader     Date: Fri, 02 Jun 2017 09:36:16 GMT<br>
      -   RespHeader     Server: Apache/2.4.25 (FreeBSD) OpenSSL/1.0.2l<br>
      -   RespHeader     X-Powered-By: PHP/7.0.19<br>
      -   RespHeader     Content-Type: text/html; charset=UTF-8<br>
      -   RespHeader     cache-control: max-age = 259200<br>
      -   RespHeader     X-Varnish: 11141123 8<br>
      -   RespHeader     Age: 73<br>
      -   RespHeader     Via: 1.1 varnish-v4<br>
      -   VCL_call       DELIVER<br>
      -   RespUnset      Server: Apache/2.4.25 (FreeBSD) OpenSSL/1.0.2l<br>
      -   RespHeader     Server: varnish<br>
      -   RespUnset      X-Powered-By: PHP/7.0.19<br>
      -   RespHeader     X-Powered-By: My Varnish<br>
      -   RespHeader     X-Cache: HIT<br>
      -   VCL_return     deliver<br>
      -   Timestamp      Process: 1496396250.098712 0.000058 0.000058<br>
      -   RespHeader     Accept-Ranges: bytes<br>
      -   RespHeader     Content-Length: 95200<br>
      -   Debug          "RES_MODE 2"<br>
      -   RespHeader     Connection: keep-alive<br>
      <b>-   Debug          "Hit idle send timeout, wrote = 89972/95508;
        retrying"</b><b><br>
      </b><b>-   Debug          "Write error, retval = -1, len = 5536,
        errno = Resource temporarily unavailable"</b><br>
      -   Timestamp      Resp: 1496396371.131526 121.032872 121.032814<br>
      -   ReqAcct        82 0 82 308 95200 95508<br>
      -   End<br>
      <br>
      Sometimes I see this Debug line also -   <b>Debug          "Write
        error, retval = -1, len = 95563, errno = Broken pipe"</b><br>
      <br>
      <br>
      I also installed varnish 5.1.2 but the results are the same.<br>
      Is there something I miss?<br>
      <br>
      My vcl file is pretty basic.</p>
    <p><a class="moz-txt-link-freetext" href="https://pastebin.com/rbb42x7h">https://pastebin.com/rbb42x7h</a><br>
      <br>
      Thanks all for your time.<br>
      <br>
      regards<br>
      Johan<br>
      <br>
    </p>
  </body>
</html>