Skip to content

Original Link Pools

NihilDigit edited this page Nov 12, 2026 · 1 revision

Original links and service pools

Original content can carry two signed URLs with different service policies in the same FileDetail:

  • FileDetail.originMediaLink / FileDetail.originalLink prefers a nonblank, non-limited (!isLimited) isOrigin media link (category=original), falling back to octetStream (links["application/octet-stream"] / web_content_link) for free accounts, non-video files, and limited or missing original-media links.
  • downloadUrl, original variant selection (resolveVariant), PikPakFileHandle creation and subsequent link refreshes all share this rule. The contentKey (<GCID>/origin), original byte length and mediaId = null identity do not change.
  • getFile(id, usage = FILE_USAGE_FETCH) returns raw download links quickly (~200–470 ms) while omitting medias entirely. A handle reading a transcode (mediaId != null) or an originMediaLink refreshes with usage = null; raw download handles keep FILE_USAGE_FETCH, and the client's folder-listing prefetch cache never hands a FETCH response to a usage = null caller.

Service pools, candidate host rewriting, and dl-a10b exclusion

HostHealth learns edge candidates from every FileDetail (observe(detail)), keeping DEFAULT_DL_Z01A_SEEDS (dl-z01a-0041..0050) only as a fallback when a primary dl-z01a host is congested or bad. Routing state — rates, warm/cold TTFB samples, silences, mid-body stalls, suspect windows and refusals — is keyed by <family>.<root>|<pool>:

  • original: URLs carrying category=original
  • transcoded: URLs carrying category=transcoded or t=1
  • download: ordinary download URLs (t=0 or neither parameter)

Within the dl-z01a-* front-end CDN cluster, PikPakFileHandle builds an ordered candidateLinks list from the FileDetail in hand:

  • octetStream links consistently land on healthy dl-z01a-0041..0050 nodes, whereas medias links (Original, 1080P, 720P, 480P) frequently land on congested nodes (0026, 0027, 0051..0055, 0063..0064) that burst 128–256 KiB and then throttle or stall on longer ranges (Measurements).
  • Because dl-z01a-* nodes accept /download/?fid=... signatures across sibling hostnames in the same <family>.<root>, candidateLinksOf places host-rewritten URLs targeting the detail's fast octet-stream hosts ahead of congested transcode nodes (while keeping the server-issued URL first when its own host is healthy, and always retaining the original URL as a fallback).
  • Hard exclusion — dl-a10b-* is never rewritten. Older or cold-archived files resolve onto dl-a10b-xxxx (1500+ nodes). Unlike dl-z01a-*, dl-a10b-* is content-sharded storage: rewriting a dl-a10b URL onto another dl-a10b node returns HTTP 206 with a 0-byte body (EOFException). Both HostHealth.Edge.parse and PikPakFileHandle exclude dl-a10b-* from sibling steering and candidate host rewriting; recovery on dl-a10b-* reuses the issued host or mints a fresh link.

If an is_origin link ever answers 206 Partial Content with a Content-Range total length that disagrees with the caller's known original size (UrlRequest.SizeMismatch), PikPakFileHandle blacklists that URL path for the handle's lifetime and falls back to octetStream (preferMediaDetails = false) so transcoded bytes are never spliced into an original-file stream.

Work-conserving concurrency modes and atomic gate preemption

Per-file request concurrency is controlled by PikPakClient.concurrencyMode (ConcurrencyMode) and the convenience toggle PikPakClient.concurrentAcceleration:

  • ConcurrencyMode.Adaptive(ceiling = 16) (default when concurrentAcceleration = true): work-conserving concurrency up to the file's connectionBudget (8) and the account's accountConnectionBudget (16). Capacity follows live ByteClaim demand directly — playback does not run hill-climbing throughput experiments (4 → 6 → 8) or open speculative second lanes.
  • ConcurrencyMode.Fixed(connections): caps each cache's worker ceiling at connections.
  • ConcurrencyMode.Serial (concurrentAcceleration = false): clamps each open file or download to a single sequential range connection (1 block per non-durable streaming request) while preserving priority ordering, BandwidthLimiter shaping, and HostHealth steering.

All open caches, direct RangeReader calls, CID sample windows and cold-archive wake probes share one atomic ledger in SignedUrlGates:

  • Every active HTTP range holds at most accountConnectionBudget (16) slots across the client, connectionBudget (8) slots on the file, and 8 slots on the normalized URL signature (path?sortedQuery), throttled down per signature whenever the CDN reports concurrency pressure (503 or X-Xos-Err-Desc).
  • Admission is ordered by live priority (ServiceIntent.WAITING 100 > PLAYING 50 > READ_AHEAD 10 > WARM 8 > FAR_READ_AHEAD 6 > BACKGROUND_BLOCKING 5 > BACKGROUND_READ_AHEAD 1 > FinishInFlight -1), then fair foreground turns across files at >= 50, then RequestOrder.
  • When slots are full, higher service tiers (100 over < 100, >= 50 over 1..49) immediately preempt the lowest-priority newest active request (TransferPreempted), retaining its already-received prefix bytes without recording any HostHealth penalty. Within the same service tier, a single-block Required or Continuation request holds a one-block execution quantum (inBlockQuantum) so two equal-priority readers never ping-pong mid-block.
  • While any foreground owner is active (a read parked or within 5 s of its last foreground read), background downloads and background streams throttle to at most 2 workers (BACKGROUND_WORKERS_WHILE_FOREGROUND) and truncate multi-block spans at the next 256 KiB block boundary (BoundaryStop).

Supplied live measurements, 2026-11-07

An eight-region DoH and proxy-exit study found Singapore endpoints across SG/HK/TW/KR/JP/US/DE/RU. Original files on dl-z01a carried ms=th=5242880 on ordinary download signatures and category=original with ms=th=81600000 on original-media signatures.

Reported single-connection MiB/s:

Exit Ordinary download Original media
SG 4.86 1.89
HK 2.04 10.37
TW 1.72 10.82
JP 0.85 11.42
US 0.30 6.93
DE 0.18 1.69
RU 0.25 4.02

Original-media four-connection samples were SG 5.45, US 8.67 and DE 5.09 MiB/s (no KR throughput figure was included). Subsequent 2026-11-10 measurements on multi-exit lines showed that within dl-z01a-*, node assignment (0041..0050 vs 0026/0027/0053/0054) dominates actual range stability and rate (see Measurements). These figures are dated route observations, not hardcoded geographic rules.

Clone this wiki locally