Replaces slab bubble-sorting in `AbidingObjectPool` with quantized occupancy buckets.

Previously, `AbidingObjectPool::Deallocate` maintained `non_full_slabs_` in
descending `live_objects` order using a `while` loop over `SwapWithNext`. When
thousands of slabs shared the same `live_objects` count, deallocating from a
slab near the front of that tie-group chased pointers across up to thousands of
distinct slab pages, causing O(K * M) stalls during bulk backend deletions.

This change replaces `non_full_slabs_` and `SwapWithNext` with up to 16
occupancy buckets indexed by
the number of live objects per slab and tracked via a `uint16_t` bitmask.
* `Allocate` selects the fullest non-empty bucket in
O(1) via `std::bit_width`.
* `Deallocate` only moves a slab between bucket
lists when its bucket index changes or when transitioning to or from
`full_slabs_` or the spare empty slab reserve.

This increases the size of `AbidingObjectPool` by `16 * 8 = 128` bytes.

In `BM_AbidingPool_MultiSlabDeallocateChurn` (312-byte objects in 8 KiB slabs,
deallocating 1 object per slab from the head of a 13-object tie-group),
eliminating the `SwapWithNext` loop avoids the O(K * M) stall:

Slabs | Before (`SwapWithNext`) | After (16 buckets) | Speedup
----- | ----------------------- | ------------------ | -------
2,000 | 142.5 ms CPU            | 0.332 ms CPU       | ~429x
5,000 | 1,205.9 ms CPU          | 1.106 ms CPU       | ~1,090x

Also adds unit tests for `kSlotsPerSlab == 2` preallocation and
large-slot-count bucketed churn in `abiding_object_pool_test.cc`, and
`BM_AbidingPool_MultiSlabDeallocateChurn` in `abiding_object_pool_benchmark.cc`.

Protected by data structure change, not feasible to protect; covered by existing tests.

PiperOrigin-RevId: 1026469084
2 files changed
tree: d9ed0c96ec5264241286a49332aeb2f5070486d7
  1. build/
  2. depstool/
  3. quiche/
  4. .bazelrc
  5. .bazelversion
  6. BUILD.bazel
  7. CONTRIBUTING.md
  8. LICENSE
  9. MODULE.bazel
  10. MODULE.bazel.lock
  11. README.md
  12. WHITESPACE
README.md

QUICHE

QUICHE stands for QUIC, Http, Etc. It is Google‘s production-ready implementation of QUIC, HTTP/2, HTTP/3, and related protocols and tools. It powers Google’s servers, Chromium, Envoy, and other projects. It is actively developed and maintained.

There are two public QUICHE repositories. Either one may be used by embedders, as they are automatically kept in sync:

To embed QUICHE in your project, platform APIs need to be implemented and build files need to be created. Note that it is on the QUICHE team's roadmap to include default implementation for all platform APIs and to open-source build files. In the meanwhile, take a look at open source embedders like Chromium and Envoy to get started:

To contribute to QUICHE, follow instructions at CONTRIBUTING.md.

QUICHE is only supported on little-endian platforms.

Build and run standalone QUICHE

QUICHE has binaries that can run on Linux platforms.

Follow the instructions to install Bazel.

sudo apt install libicu-dev clang lld
cd <directory that will be the root of your quiche implmentation>
git clone https://github.com/google/quiche.git
cd quiche
CC=clang bazel build -c opt //...
./bazel-bin/quiche/<target_name> <arguments>

There are several targets that can be built and then run. Full usage instructions are available using the --helpfull flag on any binary.

  • quic_packet_printer: from a provided packet, parses and prints out the contents that are accessible without decryption.

Usage: quic_packet_printer server|client <hex dump of packet>

  • crypto_message_printer: dumps the contents of a QUIC crypto handshake message in a human readable format.

Usage: crypto_message_printer_bin <hex of message>

  • quic_client: connects to a host using QUIC and HTTP/3, sends a request to the provided URL, and displays the response.

Usage: quic_client <URL>

  • quic_server: listens forever on --port (default 6121) until halted via ctrl-c.

  • masque_client: tunnels to a URL via an identified proxy (See RFC 9298).

Usage: masque_client [options] <proxy-url> <urls>

  • masque_server: a MASQUE tunnel proxy that defaults to port 9661.

Usage: masque_server

  • web_transport_test_server: a server that clients can connect to via WebTransport.

  • moqt_relay: a relay for the Media Over QUIC transport for publishers and subscribers can connect to.

Usage: moqt_relay

Logging

Most log messages in QUICHE use the QUICHE_DLOG macro. In standalone quiche, these all either go to stderr, or are suppressed, based on the --stderrthreshold flag.

To send INFO level log messages to a file, you would therefore invoke

<binary> <args> > <logfile> 2>&1

Use the --helpfull flag for more.