Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

varnishncsa: Add hitmiss hitpass indicators to Varnish:handling #4217

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nigoroll
Copy link
Member

The title should say it all. Simple straight forward extension of the handling strings.

@martin-uplex

Copy link
Member

@dridi dridi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the feeling that this change is happening backwards.

bin/varnishtest/tests/u00002.vtc Outdated Show resolved Hide resolved
Comment on lines -1081 to 1094
} else if (!strcasecmp(b, "miss")) {
} else if (!strcasecmp(b, "miss") && strcmp(CTX.handling, "hitmiss")) {
CTX.hitmiss = "miss";
CTX.handling = "miss";
} else if (!strcasecmp(b, "pass")) {
} else if (!strcasecmp(b, "pass") && strcmp(CTX.handling, "hitpass")) {
CTX.hitmiss = "miss";
CTX.handling = "pass";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we conditionally update only the hitmiss in these blocks?

In both vcl_hit and vcl_miss we can degrade to a pass, so technically hitmiss should be preserved (unless "-") while the handling should be unconditionally updated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand what you are trying to say. The intention is to preserve hitmiss and hitpass when we see a call MISS or call PASS. When hitmiss turns into a pass, the value ends up as pass. Is this what you are trying to say?

Copy link
Member

@dridi dridi Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: using simplified formats %hitmiss and %handling to distinguish with hitmiss and hitpass values to hopefully avoid ambiguity.

What I had in mind was "%hitmiss/%handling" leading to for example "hitmiss/pass" after a return(pass) from vcl_miss in a hit-for-miss scenario.

Reading the current documentation for %hitmiss and %handling formats I think we should actually not change them this way because %hitmiss is intentionally limited and I think %handling is not a good host for "hitmiss" and "hitpass" values.

What I mean by that is that a hit-for-pass transaction is handled the same as a regular pass transaction, whether you return(pass) from vcl_recv, vcl_hit, or vcl_miss. You essentially get a private fetch, this is how the request is handled. This is how I think %handling should be reported (and already is if I'm reading correctly).

We should maybe leave %hitmiss and %handling formats alone and introduce a new format with a finer-grained set of values. Let's for example call it %lookup and it could have the following values:

  • hit
  • miss
  • hitmiss
  • pass (no effective lookup)
  • hitpass
  • pipe (no effective lookup)
  • purge
  • synth (no effective lookup)
  • reset (client disconnected before a lookup-or-not decision was made)

And of course, I'm counting on the documentation to clarify what's what. This way you can keep %hitmiss as a source of de-facto hit ratio with hits vs everything else in your VSL sample.

edit: replaced one %hitpass occurrence with %handling
edit2: s/replace/replaced/ in first edit

Copy link
Member Author

@nigoroll nigoroll Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you are proposing exactly the same plus purge plus reset, just as yet another different tag, which represents a superset of %handling which represents a superset of %hitmiss?

To clarify: 🟢 exists already 🟡 proposed by this PR 🔵 proposed by Dridi in addition

  • 🟢 hit
  • 🟢 miss
  • 🟡 hitmiss
  • 🟢 pass (no effective lookup)
  • 🟡 hitpass
  • 🟢 pipe (no effective lookup)
  • 🔵 purge
  • 🟢 synth (no effective lookup)
  • 🔵 reset (client disconnected before a lookup-or-not decision was made)

I have not checked if reset can be implemented properly, at this point I would guess it might be equivalent to the existing -. So all in all, the proposal is to also add purge, fine.

And should we have a new %format? @gquintard says no, @dridi says yes, I don't care. But I do not think that %format inflation helps much here, I would just keep %handling.

Copy link
Member Author

@nigoroll nigoroll Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like I forgot to reply to some comments:

What I had in mind was "%hitmiss/%handling" leading to for example "hitmiss/pass" after a return(pass) from vcl_miss in a hit-for-miss scenario.

Yes. How does this not work with the current patch? I added this to the test case: 143390b

The hitmiss rightly gets turned into a pass because of a deliberate vcl return.

What I mean by that is that a hit-for-pass transaction is handled the same as a regular pass transaction, whether you return(pass) from vcl_recv, vcl_hit, or vcl_miss. You essentially get a private fetch, this is how the request is handled. This is how I think %handling should be reported (and already is if I'm reading correctly).

😖 This patch proposes to report a difference between a regular pass and a hitpass. Before this patch, it was reported as pass, now as hitpass. That is intentional and I think it is helpful (unless we actually go for yet another %format).

Copy link
Member Author

@nigoroll nigoroll Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bugwash opinion: extend %handling, as we are going to add breaking changes with #4213 this should be a good combination.
@dridi is this ok with you? I could also see if we can get purge and reset also...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wfm

bin/varnishncsa/varnishncsa.c Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants