Replies: 1 comment
|
This has been implemented in YAOSv3 - will launch soon! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
YAOS currently uses a monolithic vault model: one vault maps to one shared Y.Doc containing markdown content, metadata, folder
structure, blob references, and tombstones. This is a deliberate V1 choice, not an accident.
That architecture gives YAOS its strongest product properties:
It also creates a real ceiling. The current docs describe roughly 40-50 MB of raw markdown text as a comfortable target for the
monolith. That is not a hard crash line, but it is the point where CPU cost, memory pressure, and mobile startup behavior become worth
treating as first-class design concerns.
This RFC does not propose re-architecting YAOS immediately.
It defines:
Why this RFC Exists
monolith.md already explains why YAOS chose the monolith.
That document is the rationale for the current design.
This RFC is different.
Its purpose is to answer the next question:
If YAOS succeeds and users push beyond the comfortable monolithic ceiling, what is the least-wrong path forward that preserves YAOS’s
core moat of atomic structural integrity?
This is a future-scaling decision framework, not a restatement of current architecture.
Motivation
There are three separate pressures here.
1. Server-side memory and compute ceilings
The current checkpoint+journal storage engine solved write amplification. It did not remove the cost of holding and operating on one
large in-memory Y.Doc.
Large vaults still pay for:
2. Client-side startup and mobile cost
Even if transport and storage are efficient, a large monolithic update still has to be:
Mobile devices will feel this first.
3. Competitive ceiling
YAOS is intentionally optimized for normal human note vaults, not 20 GB archival datasets. That is fine. But if YAOS becomes the
default recommendation for serious PKM users, the “what happens when my vault gets huge?” question stops being theoretical and becomes
a product-boundary question.
Current Architecture
Today YAOS uses:
Important current properties:
That means YAOS already has two important ingredients for a future scaling plan:
Problem Statement
The scaling problem is often described too vaguely. In practice, there are three different kinds of “history” involved:
A. Storage history
This is the checkpoint+journal layer on the server.
YAOS already compacts this. That solved the old “rewrite the whole doc on every save” failure mode.
B. Yjs causal/history state
This is the in-memory CRDT state that grows with long-lived editing churn.
This is the real monolith ceiling.
C. YAOS application-level tombstones
These are explicit file/blob deletion markers stored in the CRDT to prevent resurrection from stale devices.
These are intentional correctness data. They are not the same thing as generic Yjs causal history, and they cannot be casually
vacuumed away.
Any RFC that talks about “garbage collection” must keep these three layers separate.
Critical Observation
A naive “vacuum” is not actually a vacuum.
It is tempting to think this works:
That does not meaningfully reset causal history by itself.
In a local synthetic Yjs experiment, re-encoding and re-applying the same update preserved essentially the same encoded size, while
rebuilding a brand new doc from the materialized final text shrank it dramatically. In other words:
If YAOS wants an actual epoch reset, it must rebuild semantic state into a causally new document, not just replay the old update into
a fresh shell.
Non-Goals
This RFC does not propose:
Design Principles
Any future scaling path must be judged against these rules:
Approaches Considered
1. Stay Monolithic, Add Instrumentation and Thresholds
This is the immediate path and should happen first regardless of everything else.
Add measurement for:
Also add user-facing thresholds:
This does not solve the ceiling, but it turns “50MB-ish” into an actual operational signal instead of a vibe.
Verdict: Mandatory first step.
2. Epoch-Fenced Rebuild
This is the most pragmatic short-term escape hatch.
Mechanically, this would mean:
This is important:
What this buys us:
What it costs:
acknowledged high-water-mark registry today
The crucial nuance is that this is not “garbage collect in place.”
It is “rebuild and start a new causal era.”
Verdict: Best short-term scaling escape hatch.
3. Two-Tier Hybrid Model: Graph Doc + Leaf Docs
This is the strongest long-term scalable architecture currently on the table.
Structure:
What this preserves:
What this gives up:
What it requires:
This is probably the correct V2 architecture if YAOS ever needs to scale beyond the monolith while preserving its structural moat.
Verdict: Best long-term research direction.
4. Pure Per-File Sharding / Subdocuments Everywhere
This is the most obvious answer and the most dangerous to hand-wave.
Yes, it scales text capacity.
No, it does not preserve YAOS’s strongest guarantee.
Problems:
This may still be viable for a future “scale mode,” but it should not be the default path, and it should not be described as
equivalent to the current architecture.
Verdict: Not recommended as the first scale-up move.
Comparative View
Recommendation
The recommendation is:
1. Do not replace the monolith now
The current monolith is coherent, tested, and still the correct default for YAOS.
2. Add observability first
Before any refactor, teach YAOS to measure and report monolith health.
3. Build an epoch-fenced rebuild path as the first real escape hatch
This should be the first scaling feature that actually changes behavior.
Not because it is glamorous, but because it preserves YAOS’s strongest product property: atomic structural integrity.
4. Treat the Graph + Leaf model as V2 research
That is the serious long-term architecture if YAOS needs to serve much larger text vaults without giving up its identity.
Proposed Roadmap
Phase 1: Instrumentation
Add server and client metrics for:
Add a debug/diagnostics surface that makes vault health visible.
Phase 2: Danger-Zone UX
Add warning thresholds and user-facing messaging for large vaults.
Possible actions:
Phase 3: Epoch-Fenced Rebuild
Implement:
This should initially be manual and explicit.
Phase 4: Hybrid Research Track
Explore:
Acceptance Criteria
This RFC should be considered meaningfully implemented when:
Open Questions
encoded CRDT bytes, live markdown bytes, startup latency, or some composite score?
manual only, suggested, or eventually automatic under strict thresholds?
just path/file ID mappings, or also metadata, blob refs, and tombstones?
automatic, per-vault, or explicit at vault creation time?
All reactions