1

I am using wordpress. I deploy Varnish Using Docker. This Is My default.vcl. What's Wrong With This Config?? Sometimes, Get Random 503 Error. I Exclude Wordpress Search Page Using RegEx. Also Get Random 503 Error On wordpress Search Page Too!!

varnishlog

https://www.dropbox.com/s/ruczg2i3h/log.txt

I am Using NGINX Backened.. Help Appreciated Thanks

  • Please add the `varnishlog` output when the error occors. See https://www.varnish-software.com/developers/tutorials/troubleshooting-varnish/#backend-errors for more information about logging backend errors. Please paste the log output to your original question and I'll help you figure out what's going on based on that. – Thijs Feryn Feb 07 '23 at 11:39
  • Hello, @Thijs Feryn LOG File TOO BIG For StackOverflow. Uploaded It to Dropbox. Pls, Have a Look. Thanks – damagebrain Feb 07 '23 at 12:43

1 Answers1

1

Your log output contains the following lines:

-   Error          out of workspace (bo)
-   LostHeader     Date: 
-   BerespHeader   Server: Varnish
-   VCL_call       BACKEND_ERROR
-   LostHeader     Content-Type:
-   LostHeader     Retry-After:

Apparently you ran out of workspace memory because the size of the response.

The following parameters in your Docker config might cause that:

-p http_resp_hdr_len=65536 \
-p http_resp_size=98304 \

While increasing the size of individual headers and the total response size, the total memory consumption exceeds the workspace_backend value, which defaults to 64k.

Here's the documentation for http_resp_size:

$ varnishadm param.show http_resp_size
http_resp_size
        Value is: 32k [bytes] (default)
        Minimum is: 0.25k

        Maximum number of bytes of HTTP backend response we will deal
        with.  This is a limit on all bytes up to the double blank line
        which ends the HTTP response.
        The memory for the response is allocated from the backend
        workspace (param: workspace_backend) and this parameter limits
        how much of that the response is allowed to take up.

As you can see, it affects workspace_backend. So here's the documentation for that:

$ varnishadm param.show workspace_backend
workspace_backend
        Value is: 64k [bytes] (default)
        Minimum is: 1k

        Bytes of HTTP protocol workspace for backend HTTP req/resp.  If
        larger than 4k, use a multiple of 4k for VM efficiency.

        NB: This parameter may take quite some time to take (full)
        effect.

The solution is to increase the workspace_backend through a -p runtime parameter.

Thijs Feryn
  • 3,982
  • 1
  • 5
  • 10
  • I increased -p workspace_backend=131072 based on this answer- https://stackoverflow.com/questions/47571993/varnish-fetcherror-overflow But after one or two minutes, still getting 503 backend fetch failed, thanks – damagebrain Feb 07 '23 at 14:55
  • @damagebrain first of all, increasing worker spaces has an impact. This increased memory is reserved for every single transaction. If you have a steep increase in traffic, this can result in a surge of memory consumption. Now that you have the workspace issues more or less out of the way, please also add new `varnishlog` output. I'll help you examine it again. – Thijs Feryn Feb 08 '23 at 12:36
  • After Googling.. I Temporarily Set Worker Space...Now That Error Has Gone (for now)!! But there Is now another Interesting Error I am getting...FetchError HTC eof (-1)...also backend close...also FetchError 62 HTC eof (-1), FetchError 50 HTC eof (-1)...But On the front-end... The page is loading nicely... There is no 503 error!!!!! I forgot read somewhere that there was a Bug at varnish at Varnish 4.1 (reported by an user to G. Quintard)... Well, There is another quick Fix Introduced By G. Quintard that If We cache the Body Response By .vcl might be the Error Will Gone – damagebrain Feb 08 '23 at 16:00
  • Is this error(backend close & eof) for long http header length or something about cookie?? or slow backend?? If I deploy 2 more nginx backend and set-up Varnish as a load-balancer with health-check (vdir)...can I satisfy Varnish that there is no Slow backend??? And this EOF nightmare will gone??? Is it a permanent solution?? – damagebrain Feb 08 '23 at 16:04
  • @damagebrain First things first: don't use Varnish 4.1. It does not get updates anymore. Please either use Varnish 6.0 LTS or a more recent Varnish 7.2. Please also provide an up-to-date link to your log files. I'll examine them and figure out what's going on with the closing backends. Chances are that your backends are misbehaving, but the logs will show that. – Thijs Feryn Feb 09 '23 at 07:27
  • just setup workspace value high Fixed my problem. I load test using loader.io with 10k concurrent connection on some random pages.seems my varnish problem fixed!! Thanks again for your quick response and for your valuable time – damagebrain Feb 09 '23 at 11:52