Updating the backend definitions in VCL at runtime

Comments

7 comments

  • Rogier Mulhuijzen

    Hi Will,

    The backend timeouts you change with the req.backend variables are only changed for that particular request.

    Cheers,

    Doc

  • Reuben Smith

    Hi Doc,

    I am interested in doing what Will described above as well. Changing these backend timeouts at runtime would be useful for me, and simplify something I'm already doing in the VCL.

    I tried setting req.backend.first_byte_timeout and was shown a validation error when uploading my VCL.

    Unknown variable 'req.backend.first_byte_timeout'
    At: (input Line 1782 Pos 17)
                set req.backend.first_byte_timeout = 120s;
    ----------------##############################--------
    Running VCC-compiler failed
    

    Will this be something supported in the future? Thanks!

  • Will Delves

    I got the same issue when I tied too (as I stated as "though I don't seem to be allowed to update the timeout as I want to in the code below").

    Frustrating, as allowing this would be an elegant solution. We know which requests are likely to take longer than 'normal' requests. I'd rather not have to create a new backend (we have enough of these anyway!).

    @Doc - any change of an enhancement to allow this to be set?

  • Rogier Mulhuijzen

    Oh, crud, I do apologize. I was just going off of code that I knew was there in our Varnish, I never actually verified what the VCL variables were.

    Instead of req.backend.* it's actually bereq.backend.* and only in vcl_miss and vcl_pass.

    The three that are available are:

    bereq.connect_timeout bereq.first_byte_timeout bereq.between_bytes_timeout

  • Will Delves

    Thanks for the response Doc - much appreciated!

  • Rogier Mulhuijzen

    So for those using this right now, there's actually a bug with connection re-use at the moment. Fix has been written, hopefully going out with the next rollout. I'll post here when it's in production.

  • Rogier Mulhuijzen

    The bug was fixed, and the fix was rolled out. I forgot to update here, sorry.

Please sign in to leave a comment.