Page Cache Size vs Working Set on Neo4j Low-Traffic Instances
0 reputation · 26 Sept 2021, 17:19 UTC
0 reputation · 26 Sept 2021, 17:19 UTC
A Neo4j deployment serving a predominantly read‑only workload with limited concurrent users requires careful page cache sizing to balance memory efficiency against disk I/O. The dbms.pagecache_size setting governs the off‑heap cache that holds frequently accessed graph pages. Version‑specific default sizes and auto‑tuning behavior have changed between major releases, introducing uncertainty for cost‑optimization across deployment tiers. Application‑level read patterns and the proportion of the working set that fits in memory are primary variables influencing hit ratio and query latency.
Key constraints include the version‑sensitive default sizes, the risk that reducing cache memory could increase disk I/O if the working set exceeds the cache boundary, and the fact that settings tuned for development or desktop editions may not map directly to Aura or Enterprise pricing tiers. Additionally, employing read replicas to distribute read traffic introduces replica‑lag considerations that affect consistency requirements for latency‑critical queries.
What is the minimum dbms.pagecache_size that sustains an acceptable hit ratio for a given working set on Neo4j 5.x? Does reducing the cache size below the working set consistently increase random disk I/O, and how does this interact with dbms.tx_log.rotation_size on sparse‑write workloads? Are there version‑specific auto‑tuning mechanisms that override manual cache adjustments during runtime?
35775 reputation · 27 Sept 2021, 02:55 UTC
There is no published, version‑specific minimum value for dbms.pagecache_size that guarantees an acceptable hit ratio on Neo4j 5.x. The required size depends entirely on the portion of the working set that must reside in the off‑heap page cache for your read‑only workload.
dbms.tx_log.rotation_size controls transaction log rotation and is largely independent of the page‑cache setting; on sparse‑write workloads log rotation is driven by write volume, not by cache size.For a predominantly read‑only, low‑traffic instance, the hit ratio improves as more of the hot working set (nodes, relationships, properties, and frequently accessed index pages) fits in the page cache. When the cache holds the entire hot set, additional cache yields diminishing returns; when it is smaller, each miss forces a page read from disk, raising latency.
neostore.nodestore.db, neostore.relationshipstore.db, neostore.propertystore.db, and the index files that are actively queried, then add a modest headroom (≈10‑20 %) for growth.dbms.pagecache_size in neo4j.conf to at least that estimated size (e.g., dbms.pagecache_size=2G).dbms.page_cache.hits and dbms.page_cache.misses (available via :metrics or JMX). Compute the hit ratio = hits / (hits + misss).dbms.tx_log.rotation_sizeOn sparse‑write workloads the transaction log rotates primarily when the configured dbms.tx_log.rotation_size is reached by write activity. Page‑cache size does not affect when the log rotates; it only influences how often dirty pages are flushed during checkpoints. Thus, reducing the page cache will not directly change log‑rotation frequency, though overall disk I/O may rise due to more page reads.
To give a numeric recommendation, we need the current working‑set size (or the observed page‑cache hit ratio under load). Please provide either the estimated size of your hot data set or the measured hit ratio with the existing cache setting.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.