Repository navigation
Original Link Pools
Original content can carry two signed URLs with different service policies in the same FileDetail:
-
FileDetail.originMediaLink/FileDetail.originalLinkprefers a nonblank, non-limited (!isLimited)isOriginmedia link (category=original), falling back tooctetStream(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),PikPakFileHandlecreation and subsequent link refreshes all share this rule. ThecontentKey(<GCID>/origin), original byte length andmediaId = nullidentity do not change. -
getFile(id, usage = FILE_USAGE_FETCH)returns raw download links quickly (~200–470 ms) while omittingmediasentirely. A handle reading a transcode (mediaId != null) or anoriginMediaLinkrefreshes withusage = null; raw download handles keepFILE_USAGE_FETCH, and the client's folder-listing prefetch cache never hands aFETCHresponse to ausage = nullcaller.
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 carryingcategory=original -
transcoded: URLs carryingcategory=transcodedort=1 -
download: ordinary download URLs (t=0or neither parameter)
Within the dl-z01a-* front-end CDN cluster, PikPakFileHandle builds an ordered candidateLinks list from the FileDetail in hand:
-
octetStreamlinks consistently land on healthydl-z01a-0041..0050nodes, whereasmediaslinks (Original,1080P,720P,480P) frequently land on congested nodes (0026,0027,0051..0055,0063..0064) that burst128–256 KiBand then throttle or stall on longer ranges (Measurements). - Because
dl-z01a-*nodes accept/download/?fid=...signatures across sibling hostnames in the same<family>.<root>,candidateLinksOfplaces host-rewritten URLs targeting the detail's fastoctet-streamhosts 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 ontodl-a10b-xxxx(1500+nodes). Unlikedl-z01a-*,dl-a10b-*is content-sharded storage: rewriting adl-a10bURL onto anotherdl-a10bnode returns HTTP206with a0-byte body (EOFException). BothHostHealth.Edge.parseandPikPakFileHandleexcludedl-a10b-*from sibling steering and candidate host rewriting; recovery ondl-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.
Per-file request concurrency is controlled by PikPakClient.concurrencyMode (ConcurrencyMode) and the convenience toggle PikPakClient.concurrentAcceleration:
-
ConcurrencyMode.Adaptive(ceiling = 16)(default whenconcurrentAcceleration = true): work-conserving concurrency up to the file'sconnectionBudget(8) and the account'saccountConnectionBudget(16). Capacity follows liveByteClaimdemand 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 atconnections. -
ConcurrencyMode.Serial(concurrentAcceleration = false): clamps each open file or download to a single sequential range connection (1block per non-durable streaming request) while preserving priority ordering,BandwidthLimitershaping, andHostHealthsteering.
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, and8slots on the normalized URL signature (path?sortedQuery), throttled down per signature whenever the CDN reports concurrency pressure (503orX-Xos-Err-Desc). - Admission is ordered by live priority (
ServiceIntent.WAITING100>PLAYING50>READ_AHEAD10>WARM8>FAR_READ_AHEAD6>BACKGROUND_BLOCKING5>BACKGROUND_READ_AHEAD1>FinishInFlight-1), then fair foreground turns across files at>= 50, thenRequestOrder. - When slots are full, higher service tiers (
100over< 100,>= 50over1..49) immediately preempt the lowest-priority newest active request (TransferPreempted), retaining its already-received prefix bytes without recording anyHostHealthpenalty. Within the same service tier, a single-blockRequiredorContinuationrequest 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 sof its last foreground read), background downloads and background streams throttle to at most2workers (BACKGROUND_WORKERS_WHILE_FOREGROUND) and truncate multi-block spans at the next256 KiBblock boundary (BoundaryStop).
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.
Using the SDK
- Getting Started
- Best Practices
- Playback
- Original Link Pools
- Magnets and Instant Create
- Drive Operations
- Delta Sync
- Uploads and Offline Tasks
- Errors and Retries
Understanding it
Working on it