varnish-cache icon indicating copy to clipboard operation
varnish-cache copied to clipboard

feature: Transit buffer

Open fwsGonzo opened this issue 4 years ago • 13 comments

This PR implements the transit buffer feature (previously called pass buffering).

fwsGonzo avatar Apr 12 '21 08:04 fwsGonzo

Feel free to give some input on what the defaults should be. Zero bytes transit buffer has to be allowed, because that disables the feature.

fwsGonzo avatar Apr 12 '21 09:04 fwsGonzo

I rebased against latest and added a commit message. The message is not very long right now so if there's anything you would like me to add there, I will be happy to do that.

fwsGonzo avatar Aug 30 '21 14:08 fwsGonzo

I force-pushed a split of the transit buffer patch into 4 commits. Doing so, I tried to polish the commit log, C code and test cases. I couldn't make c112 fail reliably with transit buffer disabled (it passes reliably when enabled) so I didn't keep it.

dridi avatar Dec 07 '21 12:12 dridi

powwow: @nigoroll to propose an implementation without the timeout

nigoroll avatar Dec 13 '21 13:12 nigoroll

FTR, /me feels bad about not having got to this todo item

nigoroll avatar Mar 28 '22 13:03 nigoroll

rebased onto master here https://github.com/nigoroll/varnish-cache/tree/transit_buffering for the rebase I renamed all test cases by incrementing the test case number by one now working on the proposed change

nigoroll avatar Jun 01 '22 07:06 nigoroll

tests/c00110.vtc (formally tests/c0009.vtc) is not reliable on the rebased but otherwise onmodified a2ca25fc658afe0d6d69d010ff5bfb0b647887a0

$ ./varnishtest -in 1000 -j50 tests/c00110.vtc 
...
---- v1    Not true: VBE.vcl1.s1.conn (1) == 0 (0)

@fwsGonzo / @Dridi could you look into this? My plan on this ticket was to implement my proposed change (which I still think should be safe, sound and simple), but this issue seems non trivial and is blocking any other progress...

nigoroll avatar Jun 01 '22 08:06 nigoroll

I am running on an X1 Carbon laptop running the same test with lower parallelism, but I am unable to reproduce. Should add that I am extending varnishtest to support my CMake build system, but other than that everything is the same. I rebased using your transit_buffering branch.

fwsGonzo avatar Jun 01 '22 10:06 fwsGonzo

@fwsGonzo For our convenience, would you force-push this branch please?

Regarding the test, there was no CMake/make involved in the test failure, just pure varnishtest. But I tried to reproduce it again and it seems to go away after a make clean && make. So I guess this was a false alert from my end, sorry.

nigoroll avatar Jun 01 '22 10:06 nigoroll

I pushed my VC working tree here: https://github.com/fwsGonzo/varnish-cache/tree/latest_transit

There are a few scuffed commits in there as I am trying to keep the fuzzing support up to date, but it's getting harder with time.

fwsGonzo avatar Jun 01 '22 10:06 fwsGonzo

@fwsGonzo can we just have the branch for this PR updated without unrelated commits please?

nigoroll avatar Jun 01 '22 10:06 nigoroll

You can push to it if you want!

fwsGonzo avatar Jun 01 '22 10:06 fwsGonzo

So I would like to propose to remove the timeout while waiting on the condition variable, based on the argument that we do not need it if our code is correct, and if our code is not correct, we should rather fix it than add stop-gaps. See https://github.com/nigoroll/varnish-cache/commit/904e419a39860d17dd7df79538a96284a5d4f22f from https://github.com/nigoroll/varnish-cache/tree/transit_buffering-notimeout The only thing that was missing was a wakeup on the condvar for the HSH_Cancel() path.

nigoroll avatar Jun 01 '22 11:06 nigoroll

Dear all,

Do we have an estimation when it will be merged and for which version?

Really interesting feature that can save memory and optimize stability 😁

anthosz avatar Oct 11 '22 19:10 anthosz

@anthosz You can probably just build this PR from source and use it as-is. As long as @nigoroll did not break anything with his improvements, it should be fine. This feature has been running in production in the enterprise version of Varnish for a long time now.

fwsGonzo avatar Oct 24 '22 06:10 fwsGonzo

@anthosz You can probably just build this PR from source and use it as-is. As long as @nigoroll did not break anything with his improvements, it should be fine. This feature has been running in production in the enterprise version of Varnish for a long time now.

Thank you but it's strange that it's not merged in this case 🤔

anthosz avatar Oct 26 '22 04:10 anthosz

Pushed in the context of this PR: caf49d8b42b97c3599e01f2e503d24991a1a0bcf

nigoroll avatar Nov 07 '22 14:11 nigoroll