This repository was archived by the owner on Feb 16, 2026. It is now read-only.
Commit 411add2
committed
hash: Treat a waiting list match as a revalidation
If a fetch succeeded and an object was inserted as cacheable, it means
that the VCL did not interpret the backend response as revalidated and
shareable with other clients on the waiting list.
After changing the rush to operate based on objcore flags instead of
the call site deciding how many clients to wake up, the same objcore
reference is now passed to requests before they reembark a worker. This
way when an objcore is already present during lookup we can attempt a
cache hit directly on the objcore that triggered the rush, removing a
degree of uncertainty in the waiting list behavior.
Instead of repurposing the req::hash_objhead field into an equivalent
req::hash_objcore, the field is actually removed. In order to signal
that a request comes back from its waiting list, the life time of the
req::waitinglist flag is extended until cnt_lookup() is reentered. But
to avoid infinite rush loops when a return(restart) is involved, the
flag is turned into a req::waitinglist_gen counter to prevent objcore
rushes from affecting requests entering the waiting list after they
began for a given objcore.
If the rushed objcore matches a request, the lookup can result in a
hit without entering the regular lookup critical section. The objhead
lock is briefly acquired to release req's reference on the objhead, to
rely solely on the objcore's objhead reference like a normal hit, and
generally perform hit-related operations. This change brings back the
exponential rush of cacheable objects briefly neutered.
This shifts the infamous waiting list serialization phenomenon to the
vary header match. Since most spurious rushes at every corner of objhead
activity are gone, this change puts all the spurious activity on the
incompatible variants alone instead of all objects on more occasions.
If a cacheable object was inserted in the cache, but already expired,
this behavior enables cache hits. This can be common with multi-tier
Varnish setups where one Varnish server may serve a graced object to
another, but true of any origin server that may serve stale yet valid
responses.
The waiting list enables a proper response-wide no-cache behavior from
now on, but the built-in VCL prevents it by default. This is also the
first step towards implementing no-cache and private support at the
header field granularity.
fgen1 parent 604459b commit 411add2
7 files changed
Lines changed: 250 additions & 31 deletions
File tree
- bin
- varnishd/cache
- varnishtest/tests
- include/tbl
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
| 357 | + | |
357 | 358 | | |
358 | 359 | | |
359 | 360 | | |
| |||
468 | 469 | | |
469 | 470 | | |
470 | 471 | | |
| 472 | + | |
471 | 473 | | |
472 | 474 | | |
473 | 475 | | |
| |||
494 | 496 | | |
495 | 497 | | |
496 | 498 | | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | 499 | | |
501 | 500 | | |
502 | 501 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
355 | 356 | | |
356 | 357 | | |
357 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
358 | 394 | | |
359 | 395 | | |
360 | 396 | | |
| |||
383 | 419 | | |
384 | 420 | | |
385 | 421 | | |
| 422 | + | |
386 | 423 | | |
387 | 424 | | |
388 | 425 | | |
389 | 426 | | |
390 | 427 | | |
391 | 428 | | |
392 | 429 | | |
393 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
394 | 448 | | |
395 | 449 | | |
396 | | - | |
| 450 | + | |
| 451 | + | |
397 | 452 | | |
398 | | - | |
399 | | - | |
| 453 | + | |
| 454 | + | |
400 | 455 | | |
401 | | - | |
402 | 456 | | |
403 | 457 | | |
404 | 458 | | |
| |||
581 | 635 | | |
582 | 636 | | |
583 | 637 | | |
584 | | - | |
585 | | - | |
586 | | - | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
587 | 641 | | |
588 | | - | |
| 642 | + | |
| 643 | + | |
589 | 644 | | |
590 | | - | |
| 645 | + | |
591 | 646 | | |
592 | 647 | | |
593 | 648 | | |
| |||
623 | 678 | | |
624 | 679 | | |
625 | 680 | | |
| 681 | + | |
626 | 682 | | |
627 | 683 | | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | 684 | | |
633 | 685 | | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
634 | 691 | | |
635 | 692 | | |
| 693 | + | |
636 | 694 | | |
637 | 695 | | |
638 | | - | |
639 | | - | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
640 | 699 | | |
641 | 700 | | |
642 | 701 | | |
643 | | - | |
| 702 | + | |
644 | 703 | | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
645 | 707 | | |
646 | 708 | | |
647 | 709 | | |
| |||
902 | 964 | | |
903 | 965 | | |
904 | 966 | | |
905 | | - | |
906 | | - | |
| 967 | + | |
| 968 | + | |
907 | 969 | | |
908 | 970 | | |
909 | 971 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
558 | | - | |
| 558 | + | |
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
562 | | - | |
563 | 562 | | |
564 | 563 | | |
565 | 564 | | |
566 | 565 | | |
567 | 566 | | |
568 | 567 | | |
569 | | - | |
570 | | - | |
571 | | - | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
572 | 575 | | |
573 | 576 | | |
574 | 577 | | |
| |||
584 | 587 | | |
585 | 588 | | |
586 | 589 | | |
587 | | - | |
| 590 | + | |
588 | 591 | | |
589 | 592 | | |
590 | 593 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
228 | | - | |
| 227 | + | |
229 | 228 | | |
230 | 229 | | |
231 | 230 | | |
| |||
0 commit comments