LibreSocial · Documentation

Data Synchronization & Replication Consistency

Deep-dive page: how replicated social data converges, stays valid, and survives churn and offline periods.

Sources in order of authority: current code (com.p2pframework.DDS, PAST replication in com.p2pframework.storage.past) first; then newest first: Masinde dissertation 2020 (churn/replication studies) → PG 2013 report (signed replication, offline notifications) → Graffi & Xu CTS 2014 (update/consistency protocol, still the design reference) → PG 2012 report (remote-operation protocol).

Where "synchronization" happens in LibreSocial

There is no single sync daemon; consistency is maintained at four layers:

  1. DDS object level — the update path. Writers apply remote operations against bucket chains instead of republishing whole objects; a four-step protocol (request, hash/version comparison, ordered apply, done message) serialises concurrent writers, and a random nonce in the signed item prevents replay (PG 2012, CTS 2014). Concurrent updates converge through bucket merge + tombstones; consolidation then removes deleted shares (deleted-entry share 0.3 → <0.05; splitsize 20 a good trade-off) — see DDS internals.
  2. Replication level — PAST keeps RF copies of each bucket (RF = leafsetSize/2 + 1). PG 2013 added signature validation before a replica is accepted (SecureStorageItem signing fix — the same signing bug had affected PastryStorageItem and DistributedDataItemContainer); the dissertation shows RF must grow with the network to stay stable (dissertation).
  3. Content-push level (social caching) — wall/profile updates are pushed to subscribers, which is what makes cached copies provably consistent (ISNCC 2020, caching).
  4. User level (offline periods) — the Notifications plugin stores messages offline on reachable peers so a returning user receives everything missed, including key distribution traffic for group encryption (PG 2013, access control).

Churn behaviour (authoritative measurement)

The dissertation's churn experiments show FreePastry + the capacity protocol handle join/leave storms without service degradation up to 2000 nodes, with weak nodes excluded from routing and storage (systematic evaluation, dissertation). Earlier Paderborn testing had already disabled the parallel/iterative routing optimisation due to churn problems and set search timeouts to 5 s (PG 2013) — a small example of newer work superseding an older optimisation.

Known weaknesses (open work items)

Design choice: eventual convergence, per-object serialisation

LibreSocial deliberately avoids global clocks or vector clocks per user: ordering is enforced per bucket via the remote-operation handshake, and cross-bucket conflicts are accepted and merged at the DDS level. The rationale (CTS 2014): social data operations are user-paced and commutative enough (add/delete entries) that object-granular convergence is cheaper than transactional machinery, while the security layer guarantees who may write at all (access control).

DDS internals · caching · StorageDispatcher component · PAST storage component · evaluation benchmarks