Commit 07fd003
Migrate compression to ManagedCompression (#722)
Summary:
Pull Request resolved: #722
Migrate the three ZSTD compression callsites in `LeafNodeRank.cc` from raw `folly::compression::getCodec(CodecType::ZSTD)` to ManagedCompression, the documented Meta standard for application-level compression in fbcode (per `fbcode/.llms/rules/managed_compression.md` and the `managed_compression_integration` skill). ManagedCompression handles dictionary training, parameter tuning, and rollout via infrastructure rather than hard-coded codec choice/level.
Three callsites migrated, two categories:
- `compressPayload` (line ~399) — `leaf_random_string` category
- `decompressPayload` (line ~409) — `leaf_random_string` category (same as compressPayload, since both operate on the same pseudo-random payload bytes — required so ManagedCompression serves the right dictionary on decompress)
- `compressThrift` (line ~416) — `leaf_thrift_payload` category (serialized RankingResponse / CompactProtocol — distinct payload shape)
Following the canonical pattern from `common/managed_compression/examples/ManagedCompressionExample.cpp`:
- One process-wide `folly::Singleton<ManagedCompressionFactory>` keyed by oncall=`chips_dcperf` and project=`feedsim`. Constructing a factory per call is explicitly discouraged.
- `getCachedCodec(category)` per category, preferred over `getCodec()` for hot paths.
- 2 categories, both clearly distinct payload shapes (random bytes vs thrift CompactProtocol). Per the skill, category count is kept modest.
Open-source build path: the benchpress repo is open-sourced and ManagedCompression is internal-only, so the include and use sites are gated behind `#ifdef BENCHPRESS_INTERNAL`. When the gate is undefined (the current OSS / CMake build path that all install scripts use today), the original raw folly ZSTD code remains as the fallback so the OSS build still works. `LeafNodeRank.cc` has no Buck build target — it is built only by CMake at fbpkg-install time — so no Buck-side wiring is needed in this commit. A follow-up (Phase 6) can add `-DBENCHPRESS_INTERNAL=1` to the internal CMake invocation to flip the gate on.
Stack position: depends on `bebd655f6d` (Phase 4-B thrift structs). Sibling of Phase 5-A mock_services (`bd2517aa83`).
Reviewed By: charles-typ
Differential Revision: D103768051
fbshipit-source-id: 307a9a1e9d939a7feeb0a673997824134eaf792c1 parent 62a2b7f commit 07fd003
1 file changed
Lines changed: 71 additions & 1 deletion
Lines changed: 71 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
31 | 46 | | |
32 | 47 | | |
33 | 48 | | |
| |||
396 | 411 | | |
397 | 412 | | |
398 | 413 | | |
399 | | - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
400 | 458 | | |
401 | 459 | | |
402 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
403 | 464 | | |
404 | 465 | | |
405 | 466 | | |
406 | 467 | | |
| 468 | + | |
407 | 469 | | |
408 | 470 | | |
409 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
410 | 475 | | |
411 | 476 | | |
412 | 477 | | |
413 | 478 | | |
| 479 | + | |
414 | 480 | | |
415 | 481 | | |
416 | 482 | | |
417 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
418 | 487 | | |
419 | 488 | | |
420 | 489 | | |
421 | 490 | | |
| 491 | + | |
422 | 492 | | |
423 | 493 | | |
424 | 494 | | |
| |||
0 commit comments