r/PinoyProgrammer • • Sep 21 '26

discussion Distributed worker / S3 timeout question

Linux / DevOps guys, baka may naka-encounter na ng ganitong problem.

May async worker ako na kumukuha ng tasks through WebSocket, then bawat task roughly 50-130 MB yung data na dina-download at inu-upload sa S3-compatible storage.

Problem ko ngayon: may periods na biglang humahaba yung upload time. Normally a few seconds lang, pero minsan nagiging 20–40+ seconds.

Ang mas interesting, habang may mababagal na upload, yung ibang bagong tasks naiipon sa queue. Yung ibang task pag finally naprocess na, mabilis naman yung actual GET/PUT.

pero rejected na siya ng server dahil masyado nang matagal mula nung na-assign yung task.

So parang ganito:

task assigned → queue wait → GET → PUT → submit result

Pero kapag nagkaroon ng ilang slow PUTs, yung succeeding tasks tumatagal sa queue.

Questions ko sana sa mga naka-experience na ng distributed workers / S3 / async queues:

  1. Sa ganitong setup, paano niyo dini-distinguish kung queue starvation ang primary problem vs. slow downstream storage?
  2. May recommended way ba para i-isolate ang slow destination/endpoint para hindi ma-block yung fast tasks?
  3. Sa systems na may task ownership/lease, saan normally nagsisimula ang timeout, assignment time, queue time, or execution time?
  4. Anong telemetry ang pinaka-useful para ma-prove kung queue aging ang cause ng rejected tasks?

Currently may per-task logs ako for queue wait, GET time, PUT time, total execution time, destination, and final server response.

Gusto ko muna sana maintindihan yung correct way to diagnose yung failure mode bago ako mag-change ng architecture.

Salamat sa makakapag-share ng actual experience.

9 Upvotes

27 comments sorted by

View all comments

Show parent comment

1

u/Arkad77 Sep 21 '26

Btw bro, yung TCP/keep-alive point mo pala yung gusto ko sana ma-check. May usual way ba kayo dati para makita kung reused connection or bagong TCP connection per upload? Kahit tool/metric lang na ginagamit niyo.

1

u/Arkad77 Sep 21 '26 edited Sep 21 '26

Ako yung nagha-handle nung node side. May mga 50MB R2 uploads kami na normally 3–5 sec lang pero minsan biglang 25–50+ sec, kahit okay naman CPU/RAM/disk at wala rin kaming nakitang packet loss.

Shared httpx.asyncclient na rin kami with keep-alive, kaya gusto ko lang ma-check kung connection/TCP behavior ba yung dahilan or talagang nasa R2 side yung delay.

Yung packet capture na sinabi mo mukhang magandang way para ma-verify. Anong usual tcpdump filter or setup niyo para makita kung bagong TCP connection ba yung upload or reused connection?