Commit e9b9346
authored
[LKB-5974][PG_17] Add the ability to reduce FPI (#792)
# Context
**Why is a full page image(FPI) unnecessary in Lakebase/Neon?**
In vanilla PostgreSQL, full-page images (FPIs) are required to guard against torn page writes caused by non-atomic 8 KB page writes to local storage.
However, in the Lakehouse/Neon architecture, FPIs are generally not needed because the compute node never overwrites pages in place. Instead, all modifications are logged as WAL records and sent to the pageserver, which appends them into the storage layer’s log-structured layout. Since there is no local data-file page overwriting, the torn-page risk that FPIs protect against does not exist on the compute node’s local storage.
**Why do we want to reduce the full page image?**
Full-page images amplify every small update into an 8 KB WAL write, which drives up WAL volume and causes Reverse ETL ingestion to hit the max_wal_rate limit in Serverless Lakebase.
**Why not eliminate full-page images entirely?**
Full-page images help the pageserver reduce read-path I/O by providing complete page snapshots that can be used during page reconstruction. Removing FPIs entirely could negatively impact read performance.
# Summary
This PR(along with the hadron PR: https://github.com/databricks-eng/hadron/pull/3155 )implements reducing FPI to improve write performance for data ingestion workloads, specifically reverse ETL and Spark streaming use cases. The feature is opt-in per table to avoid unintended impact on other customers.
## Performance Impact
Testing shows 3.75x write throughput improvement without significantly impacting read performance. See [performance analysis.
](https://docs.google.com/document/d/19yY8nogB5hTjXmAsX-5GT4LVDNX3c86_gK2Y6Fu7TTw/edit?tab=t.quizviqwhqh0#heading=h.kw4pwpzifs9u)
# Major changes
## Probabilistic reducing FPI generation to 5%
Added `neon_should_suppress_fpi` which will randomly determine if we should suppress FPI with a default value of 5%. The 5% is chosen to:
- Significantly reducing WAL volume to avoid write-amplification bottlenecks.
- Retaining a small number of FPIs so the pageserver still benefits from occasional full-page snapshots, helping maintain efficient read-path performance.1 parent 178558d commit e9b9346
File tree
3 files changed
+38
-2
lines changed- src
- backend/access/transam
- include/access
3 files changed
+38
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
867 | 867 | | |
868 | 868 | | |
869 | 869 | | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
870 | 874 | | |
871 | 875 | | |
872 | 876 | | |
| |||
877 | 881 | | |
878 | 882 | | |
879 | 883 | | |
880 | | - | |
| 884 | + | |
| 885 | + | |
881 | 886 | | |
882 | 887 | | |
883 | 888 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
96 | 102 | | |
97 | 103 | | |
98 | 104 | | |
| |||
529 | 535 | | |
530 | 536 | | |
531 | 537 | | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
532 | 548 | | |
533 | 549 | | |
534 | 550 | | |
| |||
618 | 634 | | |
619 | 635 | | |
620 | 636 | | |
621 | | - | |
| 637 | + | |
622 | 638 | | |
623 | 639 | | |
624 | 640 | | |
| |||
630 | 646 | | |
631 | 647 | | |
632 | 648 | | |
| 649 | + | |
633 | 650 | | |
634 | 651 | | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
635 | 656 | | |
636 | 657 | | |
637 | 658 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
46 | 56 | | |
47 | 57 | | |
48 | 58 | | |
| |||
0 commit comments