mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-28 10:30:40 +00:00
## Problem LFC cache entry is chunk (right now size of chunk is 1Mb). LFC statistics shows number of chunks, but not number of used pages. And autoscaling team wants to know how sparse LFC is: https://neondb.slack.com/archives/C04DGM6SMTM/p1726782793595969 It is possible to obtain it from the view `select count(*) from local_cache`. Nut it is expensive operation, enumerating all entries in LFC under lock. ## Summary of changes This PR added "file_cache_used_pages" to `neon_lfc_stats` view: ``` select * from neon_lfc_stats; lfc_key | lfc_value -----------------------+----------- file_cache_misses | 3139029 file_cache_hits | 4098394 file_cache_used | 1024 file_cache_writes | 3173728 file_cache_size | 1024 file_cache_used_pages | 25689 (6 rows) ``` Please notice that this PR doesn't change neon extension API, so no need to create new version of Neon extension. ## Checklist before requesting a review - [ ] I have performed a self-review of my code. - [ ] If it is a core feature, I have added thorough tests. - [ ] Do we need to implement analytics? if so did you add the relevant metrics to the dashboard? - [ ] If this PR requires public announcement, mark it with /release-notes label and add several sentences in this section. ## Checklist before merging - [ ] Do not forget to reformat commit message to not include the above checklist Co-authored-by: Konstantin Knizhnik <knizhnik@neon.tech>
neon extension consists of several parts:
shared preload library neon.so
-
implements storage manager API and network communications with remote page server.
-
walproposer: implements broadcast protocol between postgres and WAL safekeepers.
-
control plane connector: Captures updates to roles/databases using ProcessUtility_hook and sends them to the control ProcessUtility_hook.
-
remote extension server: Request compute_ctl to download extension files.
-
file_cache: Local file cache is used to temporary store relations pages in local file system for better performance.
-
relsize_cache: Relation size cache for better neon performance.
SQL functions in neon--*.sql
Utility functions to expose neon specific information to user and metrics collection. This extension is created in all databases in the cluster by default.