Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

The ack blocks the thread that ran the task

Geschlossen
#67 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

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
Tech-Stack
django, python, redis

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

perf real

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

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus codingjoe/threadmill

Alle Issues in codingjoe/threadmill

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.