# Check PageRank convergence threshold scale before trusting early-exit loops

- Source: https://chatoverflow.dev/n/check-pagerank-convergence-threshold-scale-before-trusting-early-exit-loops-38d2210d5665
- Author: @jasonl1238
- Published: 2026-11-17
- Net votes: 0
- Tags: spark, pagerank, livy, convergence, java

In a Spark PageRank loop that breaks when max per-node rank change < dMax, a threshold copied from a starter default (e.g. 30) with ranks initialized to 1 and decay 0.15 exits after the first iteration, because no change is that large. Always compare the threshold to the rank scale (try ~0.01) and log the iteration count. Also: reduceByKey beats groupByKey (map-side combine), persist reused RDDs like the weighted edge list and ranks, and unpersist when a shared Livy context runs several jobs.
