The ack blocks the thread that ran the task
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Bereich
- backend, distributed-systems, performance
Rechercherichtung
Start at the consumer loop where fetch, execute, and acknowledge are serialized, and compare its stop-and-join handling with the prefetcher. Validate the design on a quiet machine, covering writer shutdown, ack failure ordering, durability trade-offs, and the latency-bound benchmark target.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Each task acknowledgement sits on the critical path of the consumer. The loop fetches a task, runs it, calls acknowledge(), and starts again. Prefetching removed the fetch round trip from that path. The ack still blocks the thread that just ran the task.
Measurement (20,000 echo tasks, one process, one thread, prefetch 128, loaded machine): the ack uses 63 µs of client CPU and 97 µs blocked on the response for each task. The per-task wall time is 318 µs. The ack is thus about half of the loop. The blocked part is pure latency that the worker can use for the next task.
Proposal
Give finished results to an ack writer instead of an inline ack. The consumer puts the completed TaskResult in a queue and immediately picks up the next task. A dedicated thread serializes and acknowledges the results. Prefetch already hides the fetch round trip. This change hides the other one.
Trade-offs that need a decision
- The durability window becomes slightly wider. A crash between execution and ack already loses the ack today. A queue between the two extends that window by one task. The lease reaper covers the task, but the result of a completed task can be lost. Today the result is written immediately.
- Shutdown order. The writer must drain before the process exits. It needs the same stop-and-join handling as the prefetcher.
- It hides latency but does not remove work. The CPU cost stays. On a CPU-saturated host or with several worker threads that already overlap their acks, the gain is smaller. The win applies to latency-bound configurations with one thread.
- Ordering. Acks do not need an order today. A queue raises the question of what occurs when one ack fails and the next ack succeeds.
Why this issue exists
This is the largest remaining structural item. Prefetch already amortizes the fetch side (the acquire path decreases from a full round trip for each task to 0.008 calls for each task at prefetch 128). The ack is the only per-task round trip that remains. The other option is server-side work, which has a bound. Redis uses 20 to 54 µs for each task, depending on the load of the instance. That is about a tenth to a third of the loop, so the scripts alone cannot close the gap.
Found while validating per-task performance claims. This item needs a design decision, not a patch. The absolute microseconds come from a loaded machine. Measure again on a quiet machine before you commit to a target.
- Vorherrschende Sprache
- Python
- Sterne
- 19
- Forks
- 1
- Ø Merge
- 14 Std. 39 Min.
- Gemergte PRs (30 T.)
- 21
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus codingjoe/threadmill
-
Add worker pool telemetryEvtl. wieder frei @codingjoe hat das vor 100 Tagen übernommen, und es ist kein Pull Request offen. Offenenhancement
codingjoe/threadmill#18 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in codingjoe/threadmill
Ähnliche Issues
-
Maven path-index: "Ambiguous or noncanonical artifact path" error does not report the offending pathOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
pulp/pulp_maven#524 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
infinispan/langchain-infinispan#34 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
521xueweihan/HelloGitHub#3891 ·